cancel
Showing results for 
Search instead for 
Did you mean: 

Spawn new message from adapter module

Former Member
0 Kudos

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);

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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