I have created FTP Custom Service which is copying content from FTP file and sending that content in xqmessage.
But I am facing problem with this custom Service.
When only this FTP custom service is present in process I am getting message at the exit point of process.
BUt when I add any other service after this Custom FTP service then I am not getting message at exit point of process,
I tried to track down message flow in whichI am getting message till the entry of message into Custom Service not regrading exit of message
I am adding part of custom Service code here
public .. ..
dispatchMessage(MessageContent, ctx);
}
Below is dispatch method
public
throws XQException { XQEnvelope envelope =
null; XQEnvelopeFactory envFactory = svcContext.getEnvelopeFactory(); XQMessageFactory messageFactory = svcContext.getMessageFactory(); envelope = envFactory.createDefaultEnvelope(); XQMessage message = messageFactory.createMessage(); XQPart part = message.createPart(); part.setContent(content, XQConstants.
CONTENT_TYPE_XML); message.addPart(part);
// Set message properties.
// Set the message in the dispatch envelope
envelope.setMessage(message);
// Dispatch the message.
XQDispatch dispatcher = svcContext.getDispatcher(); dispatcher.dispatch(envelope); } What could be the reason of this problem?
can try after comment this line
XQDispatch dispatcher = svcContext.getDispatcher(); dispatcher.dispatch(envelope);
Still I am getting same issue after commneting
XQDispatch dispatcher = svcContext.getDispatcher(); dispatcher.dispatch(envelope);
Can you try
xqEnvelope.setMessage(incomingMessage);
// Dispatching message
xqServiceContext.addOutgoing(xqEnvelope);
After you did your custom code in service.
When you want something available at the next step/exit of your step you should not use the dispatcher. Rather, use the service context's addOutgoing() method inside your service() method.
The dispatcher is designed for asynchrnous cases, e.g. because you either not running in the context of a process or you are indeed doing some async processing.
Thomas
Hi Thomos,
When I tried to use dispatcher it didnt work but when I choose addOutgoing() ,it worked properly
What could be reson for my issue when I am using dispatcher.dispatch method?
Yashwant
Hi,
As Thomas explained, you are seeing this behavior because the dispatch API is not intended for continuing the ESB process but for sending (dispatching) a message to an ESB address.
For the message to arrive at the next step in the process the service has to address the message to its outbox (using the addOutgoing API as suggested by others on this thread).
Thanks
-Mahesh