Please describe a problem.
The below is Chopper worker poll example.
/// inspired by https://github.com/d-markey/squadron_sample/blob/main/lib/main.dart
void initSquadron(String id) {
Squadron.setId(id);
Squadron.setLogger(ConsoleSquadronLogger());
Squadron.logLevel = SquadronLogLevel.all;
Squadron.debugMode = true;
}
Future<void> main() async {
/// initialize Squadron before using it
initSquadron('worker_pool_example');
final jsonDecodeServiceWorkerPool = JsonDecodeServiceWorkerPool(
// Set whatever you want here
concurrencySettings: ConcurrencySettings.oneCpuThread,
);
/// start the Worker Pool
await jsonDecodeServiceWorkerPool.start();
/// Instantiate the JsonConverter from above
final converter = JsonSerializableWorkerPoolConverter(
{
Resource: Resource.fromJsonFactory,
},
/// make sure to provide the WorkerPool to the JsonConverter
jsonDecodeServiceWorkerPool,
);
/// Instantiate a ChopperClient
final chopper = ChopperClient(
client: client,
baseUrl: 'http://localhost:8000',
// bind your object factories here
converter: converter,
errorConverter: converter,
services: [
// the generated service
MyService.create(),
],
/* ResponseInterceptorFunc | RequestInterceptorFunc | ResponseInterceptor | RequestInterceptor */
interceptors: [authHeader],
);
/// Do stuff with myService
final myService = chopper.getService<MyService>();
/// ...stuff...
/// stop the Worker Pool once done
jsonDecodeServiceWorkerPool.stop();
}
Describe the solution you'd like
How can I config worker-poll on Chopper?
Hi @dfdgsdfg , Unfortunately I have no experience with WorkerPool. We just generation swagger code. If you have an idea, how to generate it - let us know.
Please describe a problem. The below is Chopper worker poll example.
Describe the solution you'd like How can I config worker-poll on Chopper?