exist in WSO2-ESB a mechanism to save the messages in a persistent manner and handle the send retry in the event of a serious error (eg server crash) ?
Thank you
Gordon
You just have to use a Message Store plugged on a JMS Broker (a "JMS Message Store" that will use a JMS Queue) and a Message Processor that will dequeue messages from the store.
"store" mediator will be used inside a mediation to store a Message in the store
See https://docs.wso2.org/display/ESB481/Message+Stores
and https://docs.wso2.org/display/ESB481/Message+Processors
Related
I am performing SendMessage operation in WSO2 EI 6.4.0 using AWS SQS Connector (V1.0.7).
Sometimes Message is not posted to AWS SQS Queue, got some ERROR/WARNING Message in Log mentioned below
ERROR Code from Log:
Error_code = 101506 or Error_code = 101508
Warning Message:
[HTTPS-Sender I/O dispatcher-2] WARN {org.apache.synapse.transport.passthru.Targe
tHandler} - Connection closed by target host before receiving the response Remote Address : host/ip
So whenever failure occurs, mediation will go to fault sequence , I'm just looking for some solution like retry .
Can i add some endpoint timeout error handling inside sendMessage template code and trying to rebuild the same?
Or else inside faulty sequence shall i perform same sendMessage Operation once again ?
Kindly let me know the feasible solution..
Did you try to use a Message Store and a Message Processor to implement a Guaranteed Delivery System? You have to publish the message to a Message Store. A Message Processor can try to post it to the SQS. If it fails, it will be added to another Failover Message Store. We can add the message to the original message store after some time with the help of another Message Processor. This way, it will keep on retrying until it succeeds.
https://docs.wso2.com/display/EI640/Guaranteed+Delivery+with+Failover+Message+Store+and+Scheduled+Failover+Message+Forwarding+Processor
If this solution is too complex, you can go with your second option where you call the sendMessage Operation inside the fault Sequence.
Im using WSO2 EI 6.1.1 with Message Broker, and trying to create message queue with message store and message process with an endpoint.
When I shutdown my endpoint, the message processor is deactivated and the messages stay in the queue and they are not moved to DLC.
What should I do to make it work ?
Thanks,
Faris Shomou
This is the expected behavior with message processor / message store :
A scheduled message processor will try to send the message until the
delivery is successfull (and offers you a way to implement guaranteed
delivery pattern)
A sampling message processor will send the message
in a non reliable way (it can be lost)
If you want to manage a JMS transaction and have the message to go in DLQ, use a jms inbound endpoint or jms proxy and set required parameters (transport.jms.SessionTransacted, transport.jms.SessionAcknowledgement : have a look to wso2 documentation https://docs.wso2.com/display/EI611/JMS+Transactions)
Message store / processor is used to implements Dead letter channel EIP : the jms store host the dead message and you don't want it to be moved elsewhere
I am using wso2 message broker as a message brokering system in my project. Before using wso2 message broker, I want to explore exceptional cases related to wso2 message broker queue/topic -
How many messages queue/topic can store if consumer is down and publisher is continuously sending message to queue/topic ?
What will happen if queue/topic is not available and publisher is trying to post message in queue/topic?
What is the maximum size of message queue/topic can store ? Is it configurable ?
What is the JSON message format of wso2 message broker?
Can consumer sends response to publisher after getting message from queue/topic ? If yes, How ?
What is the duration of queue/topic session timeout ? Is it configurable ?
Please find answers below.
How many messages queue/topic can store if consumer is down and publisher is continuously sending message to queue/topic ?
This depends on how much space is allocated for MB server. The messages are persisted into the DB.
What will happen if queue/topic is not available and publisher is
trying to post message in queue/topic?
Message Broker will not accept the messages. Will simply drop them.
What is the maximum size of message queue/topic can store ? Is it
configurable ?
There is no defined limit. But MB is tested with upto 10MB messages. But the performance degrades drastically as the message size grows.
What is the JSON message format of wso2 message broker?
There is no such thing.
Can consumer sends response to publisher after getting message from
queue/topic ? If yes, How ?
This is not actually supported by AMQP. In AMQP the publisher and the subscriber is decoupled. SO through WSO2 MB you cannot get this done.
What is the duration of queue/topic session timeout ? Is it
configurable ?
This can be set from the client side when connection is made.
I am using wso2esb4.7.0 and ActiveMQ 5.8.0 versions
i followed wso2esb docs they provided store and forward message store policy
But i dont want store i just want to consume those messages which is already has been store
by my client application i wish to pool that messages for every 5 sec
Is it possible in wso2esb jms using ActiveMq
will you write sample code of proxy
<messageProcessor name="Duplicate5" class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" messageStore="Duplicate" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="interval">1000</parameter>
<parameter name="message.processor.reply.sequence">fault</parameter>
</messageProcessor>
i tried with this but its not working
To pull messages from the queue, you need to use JMS transport..Check JMS proxy for the samples..
The message store persists the messages in the form of serializable Java objects. This might contain certain underlying information(E.g.: Properties) which is not visible in the message when you view message details in the ActiveMQ console. The message processor uses such information stored by the store when processing the message. Therefore, as far as I understand, the message store and message processor should be used together if you want to make things functional.
If you're straightaway storing the received messages in ActiveMQ queue, you might have to configure the message consumer manually. Check this usecase [1].
And also look in to this blogpost example to get an idea [2].
[1] http://docs.wso2.org/wiki/display/ESB470/ESB+as+a+JMS+Consumer
[2] http://nuwanwimalasekara.blogspot.com/2013/04/jms-proxy-service-using-wso2-esb.html
Hope this helps.
You can not use the Message-processor alone, You must have combination of Message Store and message processor. if you want to understand the behavior of the Message Store and Message processor refer the blog some time back.
If you want to use listen/pull from the JMS using ESB you have to use ESB as a JMS Consumer. Please refer further on document to implementation detail.
If I have a distributed CEP setup with a JMS broker as the primary input.
Now if we tell our client application to send event to Topic X, the events will be distributed to each node in the CEP cluster, as each one will be listening on same Topic X.
Will this lead to duplication of results (lets say if I am counting certain data field, now since each node is receiving duplicate data, will my count be double of actual value if I have a 2 node cluster)
Can the CEP work off a JMS Queue instead of a Topic ? This way which ever node gets the event data first will consume the message off the Queue ? Does WSO2 CEP support JMS Queues ?
No, currently (CEP 2.0.1) does not have support to receive events from JMS queue.
But if this is your requirement then you can write your own CEP addeptor(broker) to receive events from a queue and push that to CEP.
To create a custom broker
Create an appropriate Broker Type by extending org.wso2.carbon.broker.core.BrokerType and an appropriate Broker Type Factory by extending the org.wso2.carbon.broker.core.BrokerTypeFactory from the jar org.wso2.carbon.broker.core-4.0.5.jar
Then to configure that broker with the CEP create a file called "broker.xml" at wso2cep-2.0.1/repository/conf
and add the following XML:
<brokerTypes xmlns="http://wso2.org/carbon/broker">
<brokerType class="<<class reference>>" /> ...
</brokerTypes>
Find a detail documentation on creating a custom broker at http://suhothayan.blogspot.com/2013/02/writing-custom-broker-for-wso2-cep.html