How to publish "document on IS" to UM by java code?

I use below java code to publish document:

public void connection2()throws Exception{
String RNAME={“nsp://127.0.0.1:9000”};
nSessionAttributes nsa=new nSessionAttributes(RNAME);

	myReconnectHandler rhandler=new myReconnectHandler();
	nSession mySession=nSessionFactory.create(nsa, rhandler);
	mySession.init();
	
	nChannelAttributes cattrib = new nChannelAttributes();
	cattrib.setName("/wm/is/bingTest/docs/msgdocumentType");
	nChannel myChannel=mySession.findChannel(cattrib);
	System.out.println("");
	
	nEventProperties props = new nEventProperties();
	
	props.put("msg1", "bond1===");
	props.put("msg2", "===");
	nConsumeEvent evt = new nConsumeEvent("msg1",props.getByteArray(null) );
	myChannel.publish(evt);
	
}

The publish is successful,But trigger on IS occur error.

Error below:
2015-12-16 09:32:46 CST [ISS.0153.0089C] Trigger bingTest.message:new_messaging_trigger failed decoding: com.wm.app.b2b.server.dispatcher.exceptions.MessagingCoderException: java.io.EOFException

Document Type:
Please see attachments.

Trigger :
Please see attachments.

My Question:
1.My Java code is right? If no, Can you provide a sample code?
documentType.jpg
trigger.jpg

Hi,
what you are trying to do will not work, as there is no direct mapping between the fields in an IS document and the event properties.
However, if you define your IS document type with a root document called _properties, and you put msg1 and msg2 as strings inside that, then it might work.
I’m not entirely sure, because I suspect the IS trigger expects a payload as well, which you can’t easily populate from your Java code.
If you want to subscribe to such a message from IS, then I would recommend you use a JMS trigger instead of a wM Messaging trigger. Create a JMS trigger subscribing to that topic (you should create the topic from the JNDI tab in Enterprise Manager), and you will then see the msg1 and msg2 fields in the properties section of the JMSmessage coming from the trigger, allowing you to map them in the triggered Flow service.
Hope this helps.

Hi Jonathan

Thanks your reply.
The JMS trigger is Ok.