Capturing JMS events/Working with JMS (Java Messaging) in WCM


Few important things while working with JMS related in the WCM

1.      Changing the required WCM config service resource properties

topic.publishing.enabled
This must be set to true to enable message generation and delivery. Default value: false
items.topic.publishing.enabled
Indicates whether item topics are published. This must be set to true to enable messages for item state changes.Default value: true
syndication.topic.publishing.enabled
Indicates whether syndication topics are published. This must be set to true to enable messages for the status of syndication. Default value: true
prerender.topic.publishing.enabled
Indicates whether pre-render topics are published. This must be set to true to enable messages for the status of pre-rendering.Default value: true
items.topic.name
The JNDI name of the JMS topic for status changes.
Format for item state changes: jms/IWKTopics/Items

Format for syndication state changes: jms/IWKTopics/Syndication

Format for pre-rendering state changes: jms/IWKTopics/PreRender

Default value: None

I have used the following values

topic.publishing.enabled                 :::true      
items.topic.publishing.enabled         :::true      
syndication.topic.publishing.enabled:::true      
prerender.topic.publishing.enabled  :::false      
items.topic.name                             :::jms/IWKTopics/Items  


NOTE : Refer the infocenter for more details on configuration options (links are listed under resources)

2.      Creating the WCM JMS resources using the configengine task

ConfigEngine.bat/sh create-wcm-jms-resources -DPortalAdminId=username -DPortalAdminPwd=password -DuseRemoteEndPoints=false

NOTE: -DuseRemoteEndPoints=true to create the JMS resources in the cluster environment

When you execute above configengine task, portal creates following JMS resources,

a)      Creates JMS BUS called “IWKBus” and adds Portal Server/cluster as member
b)      Creates TopicSpace called “IWK.Topic.Space”
c)      Creates TopicConnectionFactory “IWKMessagingTopicConnectionFactory”
d)      Creates following topics “IWKTopics_Items” ,” IWKTopics_PreRender” & “IWKTopics_Syndication”

e)      Creates BUS queue destination “IWKQueue4IWKBus”
f)       Creates the QueueConnectionFactory “IWKQueueConnectionFactory”
g)      Creates following Queues i.e “IWKSyndicationQ” & “IWKPrerenderQ”

h)      Creates following Activation Specs i.e “IWKSyndicationMonitorActivation” & “IWKItemChangeMonitorActivation”

3.      Write MDB( message driven bean)

Write your custom business logic in the “onMessage” method of MDB  and bind that MDB in EJB binding file like below.

<jca-adapter activation-spec-binding-name="jms/IWKItemChangeMonitorActivation" destination-binding-name="jms/IWKTopics/Items"/>

4.      Message Selectors : you can specify the message selectors to avoid executing or calling the onMessage method for every item changes.

Troubleshooting

1.      Had problem while running the config engine task, I had to provide the portal admin userid and password in wkplc.properties file ( Some it didn’t accept the userid and password that is passed from command line)
2.      MessageSelectors didn’t work most of the time.

Resources

Changing the Ports for WebSphere Portal



Usually this is trivial task and can be done in multiple ways in cluster or standalone environments . But I ran into to problem while I was changing the ports where I had two versions of standalone portals installed on same box.

Usually we can change the websphere portal server ports in two simple ways 

1.      Using the ConfigEngine task
2.      Using Websphere Admin console (ISC)

Changed all ports from ISC as it is simple way to do it ,  But after I changed all ports 

1.      Restarting the server failed. As SOAP connector port is also changed and causing the stop server scripts failed to communicate with server. I had to kill the process.
2.      Accessing portal or admin console failed even though servers started successfully. 



Realized that when we change the admin ports and default host ports from the WAS admin console it doesn’t change the virtual hosts mapping on the server and caused the above problem.

virtualhosts.xml contains entry like this.

<aliases xmi:id="HostAlias_1353196570509" hostname="*" port="20017"/>
 <aliases xmi:id="HostAlias_1353196572955" hostname="*" port="20007"/>

To avoid being into this situation we have to update the virtual host port mapping from the ISC console.

NOTE: Above errors will not appear if you use the ConfigEngine task to modify the ports.

Resources::

1.      Listing the ports used by server
./ConfigEngine.sh list-server-ports -DWasPassword=passw0rd

which generates a log file: -

/opt/IBM/WebSphere/wp_profile/ConfigEngine/log/WebSphere_Portal_PortMatrix.txt

     Ports for WebSphere_Portal :
     WC_defaulthost=10039
     WC_adminhost=10042
     WC_defaulthost_secure=10029
     WC_adminhost_secure=10032
     BOOTSTRAP_ADDRESS=10035
     SOAP_CONNECTOR_ADDRESS=10025


2.      Chaning the ports using the ConfigEngine task

ConfigEngine.bat modify-ports-by-startport -DWasPassword=wasadmin -DModifyPortsServer=WebSphere_Portal -DStartPort=20000

You will see the log statements like below

 [wsadmin] {SOAP_CONNECTOR_ADDRESS {{host sivapc.sivavaka.com} {node sivapcNode} {server WebSphere_Portal} {port 20000} }}
 [wsadmin] {SIP_DEFAULTHOST_SECURE {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20001} }}
 [wsadmin] {SIP_DEFAULTHOST {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20002} }}
 [wsadmin] {SIB_ENDPOINT_ADDRESS {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20003} }}
 [wsadmin] {WC_defaulthost_secure {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20004} }}
 [wsadmin] {DCS_UNICAST_ADDRESS {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20005} }}
 [wsadmin] {SIB_MQ_ENDPOINT_SECURE_ADDRESS {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20006} }}
 [wsadmin] {WC_adminhost_secure {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20007} }}
 [wsadmin] {CSIV2_SSL_MUTUALAUTH_LISTENER_ADDRESS {{host sivapc.sivavaka.com} {node sivapcNode} {server WebSphere_Portal} {port 20008} }}
 [wsadmin] {ORB_LISTENER_ADDRESS {{host sivapc.sivavaka.com} {node sivapcNode} {server WebSphere_Portal} {port 20009} }}
 [wsadmin] {BOOTSTRAP_ADDRESS {{host sivapc.sivavaka.com} {node sivapcNode} {server WebSphere_Portal} {port 20010} }}
 [wsadmin] {CSIV2_SSL_SERVERAUTH_LISTENER_ADDRESS {{host sivapc.sivavaka.com} {node sivapcNode} {server WebSphere_Portal} {port 20011} }}
 [wsadmin] {IPC_CONNECTOR_ADDRESS {{host localhost} {node sivapcNode} {server WebSphere_Portal} {port 20012} }}
 [wsadmin] {SIB_ENDPOINT_SECURE_ADDRESS {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20013} }}
 [wsadmin] {WC_defaulthost {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20014} }}
 [wsadmin] {SIB_MQ_ENDPOINT_ADDRESS {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20015} }}
 [wsadmin] {SAS_SSL_SERVERAUTH_LISTENER_ADDRESS {{host sivapc.sivavaka.com} {node sivapcNode} {server WebSphere_Portal} {port 20016} }}
 [wsadmin] {WC_adminhost {{host *} {node sivapcNode} {server WebSphere_Portal} {port 20017} }}