java 8 - IBM MQ Message property is null in MDB -
i publishing jms text message topic , consumer able consumer ( mdb ) text message. not able message object , string property. null in mdb consumer side. have defined mdb in ejb-jar.xml under meta-inf folder. using
tomee plus 7.0.2 jms 2.0 ibm mq 8 jdk 1.8 topic
i refereed below mentioned tomee official example. in example used tomee.xml instead used resource.xml , don't use web.xml
consumer messagedrivenbean
consumer able text or object message. message property null.
@resource(name = "qcf") private connectionfactory connectionfactory; @resource(name = "wmq-javax.jms.topic") private topic topic; connection connection = connectionfactory.createconnection(); session session = connection.createsession(false, session.auto_acknowledge); messageproducer producer = session.createproducer(topic); textmessage message = session.createtextmessage(); message.settext("test message"); message.setobjectproperty("a","b"); message.setstringproperty("c","d"); connection.start(); producer.send(message); session.close(); connection.close();
consumer
<ejb-jar id="ejb-jar_id" version="3.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"> <display-name>sampletransactionmdb</display-name> <enterprise-beans> <message-driven> <display-name>sampletransactionmdb</display-name> <ejb-name>sampletransactionmdb</ejb-name> <ejb-class>com.example.sampletransactionmdb</ejb-class> <transaction-type>container</transaction-type> <activation-config> <activation-config-property> <activation-config-property-name>destinationtype</activation-config-property-name> <activation-config-property-value>javax.jms.queue</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>destination</activation-config-property-name> <activation-config-property-value>openejb:resource/projectname/topicname</activation-config-property-value> </activation-config-property> </activation-config> <activation-config-property> <activation-config-property-name>usejndi</activation-config-property-name> <activation-config-property-value>true</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>hostname</activation-config-property-name> <activation-config-property-value>x.x.x.x</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>port</activation-config-property-name> <activation-config-property-value>123</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>queuemanager</activation-config-property-name> <activation-config-property-value>xxxxx</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>channel</activation-config-property-name> <activation-config-property-value>xxxx</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>transporttype</activation-config-property-name> <activation-config-property-value>client</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>subscriptionname</activation-config-property-name> <activation-config-property-value>xxxxxx</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>sharedsubscription</activation-config-property-name> <activation-config-property-value>true</activation-config-property-value> </activation-config-property> </message-driven> </enterprise-beans> <assembly-descriptor> </assembly-descriptor> </ejb-jar>
guide me why message property null in mdb consumer.
messageproducer producer = session.createproducer(queue);
if publishing message topic why using variable named 'queue'? topic string looks 'test/abc/one' (no quotes).
secondly, why didn't post code consumer? update original posting include consumer code.
Comments
Post a Comment