on 08-25-2006 7:20 AM
I am looking for some code to spawn a new message from within an adapter module. Basically I my module does a EDI conversion to XML, and at the same time generates a FA. I want to create a new message for the FA (to then be processed).
I can create a message object OK, but am having trouble finding any documentation on how to send it. I suspect that I need to instantiate a "Connection" object, then call the send method. However the createConnection method requires a string parameter and I do not know what this should be.
My code sample if below.
Anyone got any thoughts?
Regards,
Jason
Context ctx = new InitialContext();
ConnectionFactory cf = (ConnectionFactory) ctx.lookup(
com.sap.aii.af.ra.ms.api.ConnectionFactory.JNDI_NAME);
MessageFactory factory = cf.createMessageFactory("XI");
Message msgnew = factory.createMessage(
msg.getFromParty(),msg.getToParty(),
msg.getFromService(),msg.getToService(), msg.getAction());
msgnew.setConversationId(msg.getConversationId());
msgnew.setDocument(msg.getDocument());
msgnew.setDeliverySemantics(DeliverySemantics.ExactlyOnceInOrder);
Connection con = cf.createConnection(""); **
con.send(msgnew);
Hi Jason,
this sounds exciting - but why exactly do you need to spawn the message in the Module. Wouldn't it much easier to use the standard XI mechanisms (Routing, Message Split, etc.) to create a new message with all the advantages (will show up in monitoring, easy to maintain, etc.) instead of playing with the fire of undocumented features...
regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Peter,
Thank you for your response. I have redesigned my solution, and now use a message split in the receiver determination to achieve what I needed to do.
At the same time this allowed me to move some code from an Adapter module, into a Java mapping - making it a lot easier to debug.
Thanks for your suggestion.
Regards,
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.