wso2 ESB - Proxy - WebSphere MQ Input, WebSphere MQ Output - Without Message Loss - jms

I am after the wso2 configuration/source code for a wso2 ESB proxy that can read from a WebSphere MQ Queue and write to a WebSphere MQ Queue. One way, no response.
We need reliability, i.e. the message can never be lost. No matter what the failure scenario. For any failures writing to the output queue, the message should be rolled-back to the input queue (this probably means the message should be read from the input queue using a transaction and/or client acknowledgement mode).
Examples of failures are:
Output queue full, MQRC 2053
Output queue does not exist, MQRC 2085
Output queue put inhibited
Output queue max msg size smaller than the size of the message to be sent.
Application does not have authority to send to output queue, MQRC 2035
Ideally we are trying to do this using just a wso2 ESB proxy, not a wso2 message store or wso2 message processor. Please clarify if this is possible to do using only the wso2 esb proxy, and not the other components. If this is not possible, please provide full configuration using the message store and message processor.
I am able to create a wso2 proxy to read from WebSphere MQ and write to WebSphere MQ, however in any of the failure scenarios above we lose messages.
Update at 1 June 2015: wso2 support have replicated this issue and are looking into supplying a fix/solution. I am using wso2 ESB 4.8.1.

In your proxy definition, add thoses parameters :
<parameter name="transport.jms.SessionAcknowledgement">CLIENT_ACKNOWLEDGE</parameter>
<parameter name="transport.jms.SessionTransacted">true</parameter>
In it's faultSequence : add this property :
<property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/>
You must not use "send" mediator in your inSequence, because it works asynchronously and the inSequence ends before the outSequence receive the response (or before the faultSequence receive the fault) : as soon as the inSequence ends, if property "SET_ROLLBACK_ONLY" has not been set, dequeue of the message is committed !
You can use "call" mediator. Property "ClientApiNonBlocking" can be usefull in some cases. You can use "filter" mediator after "call" mediator in your inSequence to analyse the response and decide to rollback the transaction setting "SET_ROLLBACK_ONLY" property.

Related

Apache Nifi, PublishJMS processor fails while publishing json message to IBM Websphere MQ to overwrite JMS_IBM_* properties

with ref to post : PublishJMS processor fails while publishing json message to IBM Websphere MQ -- it helps.
But i have an another issue while publishing the message to ibm mq queue as is read from another queue. the issue is with JMS_IBM_Encoding value being defaulted to 273 by nifi.
the scenario i was trying to do is, read a msg from one IBM MQ queue and put it on a different queue as is without any modifications using nifi. meaning expecting the same functionality as dump and qload in IBM MQ terms.
Please advise on how to preserve these values as is forwarding with the message.

How to add re delivery delay in WSO2 Message Broker like ActiveMQ

I have successfully configured the WSO2 Message Broker with my WSO2 ESB. I have also implemented successfully the JMS Transactions. It means that if there is an error in Service Normal Flow, Message will be rolledback.
Problem:
Previously i have configured the ActiveMq with my ESB. In that Setup i have a configuration in {ESB_HOME}/repository/conf/axis2/axis2.xml. This configuration donates the "Re-delivery Delay". This time is used to tell the MessageBroker(ActiveMQ) that when you are attempting to redeliver the message, you have to wait for this time before trying again.
<parameter name="redeliveryPolicy.redeliveryDelay" locked="true">1200000</parameter>
WSO2 Message Broker:
I want to achieve the same result in WSO2 Message Broker. I think it had to do with some configuration in {MB_HOME}/repository/conf/advanced/andes-config.xml. But i am unable to find that particular configuration setting anywhere in Message Broker.
Note: I am using WSO2 ESB 4.8.1 and WSO2 Message Broker 2.2.0.
What i want to achieve:
My goal is that i should be able to tell WSO2 Message Broker like ActiveMQ that you must take this much time before trying to re-deliver the message.
As I know it cannot be done like this in case of WSO2 MB. You have to setup a message store and a message processor guarding on that message store. And when you have a message processor it can be configured with interval and max delivery attempts.
https://docs.wso2.com/display/IntegrationPatterns/Dead+Letter+Channel
http://charith.wickramaarachchi.org/2012/05/another-message-redelivery-pattern-with.html
http://wso2.org/library/articles/2011/10/implementing-store-forward-messaging-patterns-wso2esb-part-1
http://wso2.com/library/articles/2011/12/implementing-store-forward-messaging-patterns-wso2esb-part-2/
(Alternatively, you can setup the maxAckWaitTime, it means it will wait at least 'maxAckWaitTime' seconds between two redelivery attempts)

Receiving messages from WSO2 Message Broker with Process Server

I successfully configured WSO2 Message Broker as a JMS server. I have configured WSO2 ESB to send messages to a queue, and I can see this queue get created in MB with messages.
Now, I want to consume those messages with Process Server and kick off a BPEL process. I have added the required libraries to components/lib in both ESB and BPS, and have created an identical jndi.properties in both. The URL for both ESB and BPEL is:
jms:/newMLECaseQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=queue
I have tested a similar configuration with ActiveMQ, and there BPEL succesfully picked up the messages. In MB it does not seem to work, while the logging mentions that JMS started to listen:
Started to listen on destination : newMLECaseQueue of type queue for service newMLECaseQueue {org.apache.axis2.transport.jms.JMSListener}
What can be wrong here?
It appears that each queue must be registered using jndi.properties: when adding the queue with the line:
queue.newMLECaseQueue = newMLECaseQueue
it all started to work.

WSO2 ESB Proxy - JMS Message Selector

We have WSO2 ESB listening on to a single ActiveMQ Queue. However we want to configure multiple proxies on listening on to the JMS queue.. however we want the proxy to only consume message meant for it.
Is there a mechanism to set JMS Message selector on the ESB Proxy so that it consumes only message designated for it. ?
Thanks
Rajiv Patil
AFAIK it is not possible to perform such a selection. However there are two possible approaches to achieve the above.
Let each proxy read all the messages and select which to process inside the proxy itself
Use an EIP pattern to achieve the above. One possible pattern would be Message Routing where you can select the messages and direct the message to the desired sequence or proxy which will do the processing.
Yes, you can have multiple proxy services listening to the same queue, each following a certain JMS MessageSelector. You will have to set the transport.jms.MessageSelector parameter for each proxy like this (value 100 is variable, each proxy service containing a different number):
<parameter name="transport.jms.MessageSelector">account='100'</parameter>
And the Java message producer sending the message to the JMS broker is setting the message selector with:
// this will set a key/value pair as JMS message selector
// 100 should be a variable in your case
message.setStringProperty("account", "100");
This was tested on ActiveMQ 4.7 and WSO2 ESB 4+.

Read JMS properties from an InOnly message in Camel

When sending (InOnly) JMS messages with Apache Camel, can I read back the different JMS headers that might have been set automatically on the message, when it was sent?
from("foo:bar")
.to(ExchangePattern.InOnly,"jms:queue:whatever")
.log("msg id set = ${in.header.JMSMessageId}");
I just can't figure out how to send the message "one way" but keeping the sent JMS message as "in" message in the route afterwards.
Background:
I know that I can present some values, but it would be easier if they where set by the actual JMS implementation. For instance, in this case, I want to work with WebSphere SIBus, WebSphere MQ and ActiveMQ. It's best to rely on WebSphere MQs internal message id format, because it will only index certain message formats. It might be similar aspects on the WebSphere SIBus implementation.
This feature is available starting at 2.10.3 and 2.11.0.

Resources