Announcement Announcement Module
Collapse
No announcement yet.
JMS Listener: convert xml msgs using JiBX Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMS Listener: convert xml msgs using JiBX

    I have gotten an application running that listens to a Tibco JMS topic for msgs. I'm probably over thinking what needs to be done in order to convert the inbound XML msg from Tibco into a corresponding Java Object. I'm trying to leverage JiBX to unmarshal the msg in JmsMsgConverter.fromMessage() but I'm not clear on what needs to be done in order to use my jibxSyncWorkIncidentMarshaller. Do I need to somehow use XMLStreamReader in order to convert my XML text input into something that I can pass to unmarshalXmlStreamReader() or am I off track?

    If anyone has an example using JiBX to convert an XML document to/from Java I would REALLY appreciate it!

    My app is configured as follows:

    <beans...">

    <bean id="jndiTopicConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="jms/topic/work_incident" />
    </bean>
    <bean id="tibcoTopicConnectionFactory"
    class="com.tibco.tibjms.TibjmsTopicConnectionFacto ry">
    <constructor-arg name="userName" value="${jms.username}"/>
    <constructor-arg name="password" value="${jms.pw}"/>
    </bean>
    -->

    <bean id="common.userCredentialsConnectionFactoryAdapter "
    class="org.springframework.jms.connection.UserCred entialsConnectionFactoryAdapter" abstract="true">
    <property name="username"><value>QBID_SN</value></property>
    <property name="password"><value>QBID_SN</value></property>
    </bean>

    <bean id="tibcoTopicConnectionFactory" parent="common.userCredentialsConnectionFactoryAda pter" lazy-init="true">
    <property name="targetConnectionFactory">
    <bean class="com.tibco.tibjms.TibjmsTopicConnectionFacto ry">
    <constructor-arg index="0" value="tcp://tibcrpdev01:7222" />
    </bean>
    </property>
    </bean>

    <bean id="cachingConnectionFactory"
    class="org.springframework.jms.connection.CachingC onnectionFactory"
    destroy-method="destroy">

    <property name="targetConnectionFactory" ref="tibcoTopicConnectionFactory"/>
    <property name="sessionCacheSize"><value>1</value></property>
    <property name="clientId"><value>QBID_SN</value></property>
    </bean>

    <bean id="jmsTransactionManager"
    class="org.springframework.jms.connection.JmsTrans actionManager">
    <property name="connectionFactory">
    <ref bean="tibcoTopicConnectionFactory" />
    </property>
    </bean>

    <bean id="topicJmsTemplate" class="org.springframework.jms.core.JmsTemplate" >
    <constructor-arg ref="cachingConnectionFactory"/>
    <property name="deliveryMode"><value>2</value></property>
    <property name="timeToLive"><value>-1</value></property>
    <property name="explicitQosEnabled"><value>false</value></property>
    <property name="sessionTransacted"><value>true</value></property>
    <property name="pubSubNoLocal"><value>false</value></property>
    <property name="pubSubDomain"><value>true</value></property>
    </bean>

    <bean id="jmsMsgConverter" class="com.qualcomm.qbid.msg.JmsMsgConverter" >
    <property name="jibxSyncWorkIncidentMarshaller">
    <ref bean="jibxSyncWorkIncidentMarshaller" />
    </property>
    </bean>

    <bean id="jmsMsgListener" class="com.qualcomm.qbid.msg.JmsMsgListener" />

    <jms:listener-container
    container-type="default"
    destination-type="durableTopic"
    acknowledge="transacted"
    connection-factory="cachingConnectionFactory"
    concurrency="1"
    transaction-manager="jmsTransactionManager"
    message-converter="jmsMsgConverter">
    <jms:listener
    destination="CORP.DEV.WORK_INCIDENT.SYNC.2_0"
    ref="jmsMsgListener" method="processMsg" />
    </jms:listener-container>

    <oxm:jibx-marshaller id="jibxSyncWorkIncidentMarshaller" target-class= "com.qualcomm.model.workincident.SyncIncidentWorkR equest"/>

    </beans>
Working...
X