I am publishing JMS text message to topic and consumer is able to consumer ( MDB ) the text message. But not able to get Message Object and String property. it is null in MDB consumer side. I have defined MDB in ejb-jar.xml under META-INF folder. I am 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 they used tomee.xml instead i used resource.xml and don't use web.xml
Consumer is MessageDrivenBean
Consumer is able to get Text or Object Message. But Message property is 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();
<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 is null in MDB consumer.
I found the root cause of the problem. it is my mistake. TopicProxy's targetClient should be JMS. I wrongly configured as MQ. so I was able to get message but not property.
After changing targetClient value to JMS. I am able to get message and property