you have to:
0. Include MQ libraries in your project (extract them from adapter).
1. Create and configure MQQueueManager object.
2. Configure MQMessage
3. Configure message options
4. use MQQueueManagers put method to send message.
this is my example of topic publishing:
MQQueueManager mqqueuemanager = getActiveMQManager();//returns preconfigured cashed manager MQMessage mqmessage = new MQMessage(); mqmessage.format = MQC.MQFMT_STRING; mqmessage.persistence = CMQC.MQPER_PERSISTENT; mqmessage.expiry = -1; mqmessage.write(getMyTxtMessage().getBytes("UTF-8")); mqmessage.characterSet = 1208; MQPutMessageOptions options = new MQPutMessageOptions(); options.options += CMQC.MQPMO_RETAIN; mqqueuemanager.put(CMQC.MQOT_TOPIC, "", queueManagerOut, topic, mqmessage, options); messageparams.setMessageId(mqmessage.messageId);
I'm not sure but there should be some examples on Internet...
I've configured WSMQ jca connection in a JBossAS and it's working allright. Now I'm trying to use it from a standalone application and can't figure how.
Can anyone please help?
Couple of ways
1) configre <use-java-context> true and then get the related ConnectionFactories from the InitialContext. i.e <use-java-context>true</use-java-context>
2) Have a stateless EJB at the server side which will talk to JCA adapter deployed in Jboss.