Creating new request services
I am struggling with creating new requests dynamically. I have defined my own messages and I want to do something like request.setTask("xyz");
The request will happily take whatever I pass to it if I hardcode the tasks, but I want to have a separate function that I can call and will generate these responses. Do I need to create a ServiceManager and ServiceFactory?
This:
final rosd_messages.RosDRequest request = serviceClient.newMessage();
request.setTask("xyz");
works fine. However, what if we have another task "abc" that we want to execute? What if we aren't sure how many requests there will be? I can create a new request, but I can't initialize it to serviceClient.newMessage(); as the serviceClient is final.
Any help?
Thanks! James