Mega Menu

Friday, November 22, 2013

Store and Archive Messages in WCS

Any email or sms or content in any form sent from Websphere Commerce (WCS) using the Out of the Box (OOB) messaging framework through any transported can be stored and also archived.

Eg: Order Transfer to External systems, Sending Emails, etc..

Pre-conditions :


1. While creating the message type, make sure the below option is selected





This selection updates the column PROFILE.ARCHIVEMSG to 1

2. Configure the message transmission as async in the wc-component-client.xml configuration file.


Eg:

<_config:invocationservice>
    <_config:invocationbinding bindingimpl="com.ibm.commerce.foundation.internal.client.services.invocation.impl.JCAInvocationBindingImpl">
     
    <_config:action asynchronous="true" name="MyMessageAction">
     
  (OR)

If you are directly using Messaging class to send messages, invoke

Messaging.sendTransacted ()

which sends a message asynchronously.


 Additional Info:
Messages that are sent to any external system can either be synchronous or asynchronous. In WCS messages can be sent using the task command SendMsgCmd which internally makes use of Messaging class to compose, load config and send messages through the specified transports.

If a message is marked as asynchronous, SendMsgCmd invokes the sendTransacted method of Messaging class which just saves the composed Message as a BLOB object into table MSGSTORE

 The scheduler command SendTransactedMsg, when kicked in scans through the table MSGSTORE and then sends the valid messages (leaving the expired messages) accordingly.
The scheduler in addition checks for the flag PROFILE.ARCHIVEMSG and accordingly arhives/not the message. If this flag value is 1, the message will be sent to an archive table MSGARCHIVE after successful transfer.