Sunday, February 5, 2017

Resolving Message Selector issue with Websphere commerce server

Problem Statement:
In an omnichannel system, orders will be placed to OMS through multiple channels. Order response from OMS (order management system) will be placed in the web methods topic to which multiple systems can subscribe to it. WCS is one of the systems to subscribe. If we do not put filters then all the messages placed in the topic will be consumed by WCS. This puts an unnecessary overhead on the system resource. Message selector will come in handy which filters out the message that is not intended for the system.
Sample message selector configuration in ejb-jar.xml of message driven bean is given below

<activation-config-property>
     <activation-config-propert-name>messageSelector</activation-config-propert-name>
      <activation-config-propert-value>ResponderProcessId=’WCSSTORE’</activation-config-propert-value>
</activation-config-property>

This means that message with responderprocessId =’WCSSTORE’ will reach WCS.

After deployment, ejb-jar.xml will look like below in the server
<activation-config-property>
     <activation-config-propert-name>messageSelector</activation-config-propert-name>
      <activation-config-propert-value>ResponderProcessId=&apos;WCSSTORE&apos;</activation-config-propert-value>
</activation-config-property>

On starting the server, Listener will fail to start with below exception
0000000a MDBListenerIm W   WMSG0019E: Unable to start MDB Listener OrderResponse, JMSDestination jms/poResponseTopic : javax.jms.InvalidSelectorException: [BRM.10.1100] JMS: Selector syntax error: Lexical error at line 1, column 20.  Encountered: "&" (38), after : ""
at com.webmethods.jms.selector.JmsSelector.JmsSelectorToBrokerFilter(JmsSelector.java:122)
at com.webmethods.jms.selector.JmsSelector.JmsSelectorToBrokerFilter(JmsSelector.java:74)
at com.webmethods.jms.impl.WmMessageConsumerImpl.createFilter(WmMessageConsumerImpl.java:1468)
at com.webmethods.jms.impl.WmMessageConsumerImpl.<init>(WmMessageConsumerImpl.java:91)
at com.webmethods.jms.impl.WmTopicSubscriberImpl.<init>(WmTopicSubscriberImpl.java:28)
at com.webmethods.jms.impl.WmSessionImpl.createDurableSubscriber(WmSessionImpl.java:1226)
at com.webmethods.jms.loadbalance.connection.WmClusterMessageConsumerImpl.createConsumer(WmClusterMessageConsumerImpl.java:178)
at com.webmethods.jms.loadbalance.connection.WmClusterMessageConsumerImpl.<init>(WmClusterMessageConsumerImpl.java:106)
at com.webmethods.jms.loadbalance.connection.WmClusterTopicSubscriberImpl.<init>(WmClusterTopicSubscriberImpl.java:41)


Reason for this issue
 (a) The problem is that the application server ALWAYS rewrites the ejb-jar.xml file during deployment.  IBM fixed this in newer versions of WAS a few years ago, and now WAS only writes the ejb-jar.xml file if it needs to add new information.
(b)   WebMethods broker cannot unescape the escaped characters. It cannot convert &apos: to ‘ as it does not have any specific settings to do this on the broker.  Since Web methods broker could not able to recognize the &apos; server failing to start.
(c)    This issue will not happen in WAS version 7.0.0.31 and it happens in WAS version 7.0.0.37.

Resolving the issue:

(a)    An iFix PI63953 needs to be applied.( 7.0.0.37-WS-WAS-IFPI63953.pak)
(b)   Even with the fix, the application server will still rewrite the ejb-jar.xml during deployment if the ejb-jar.xml does not have complete information.  The app server scans the EJB class files and   
might find information about the business methods that needs to be written to the ejb-jar.xml file to make it complete. 
(c)      To avoid this rewrite of the file, you need to make sure the ejb-jar.xml file is complete before you deploy it.  i.e Deploy the application. Take the ejb-jar.xml from server and compare it with the original. If any tags are missing then add those tags and do full build and deployment.
(d)   With this change the ejb-jar.xml will not be rewritten by WAS.                           







No comments:

Post a Comment