WSO2 ESB task (scheduler) doesn't work - jms

I have to send XML message to my jms proxy service (service receive and send back message over JMS) with ESB Task (scheduler).
I tried 2 solutions.
1 solution
In added task I fill:
message -> my XML
injectTo -> set 'proxy'
proxyName -> my proxy name
The result is that, my jms proxy receive the message but without JMS_Corelation (I guess the message is send local in ESB) and I get that error:
Unexpected error sending message back
org.apache.axis2.AxisFault: Transport out has not been set
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:432)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:163)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:321)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:94)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:255)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:556)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:198)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.local.LocalResponder.handleResponse(LocalResponder.java:214)
at org.apache.axis2.transport.local.LocalResponder.invoke(LocalResponder.java:111)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:163)
at org.apache.synapse.mediators.builtin.RespondMediator.mediate(RespondMediator.java:23)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:255)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:556)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:198)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
If I send this message to queue, all workflow works fine, so it is well configure.
2 solution
In added task I fill:
message -> my XML
to -> my jms endpoint
format -> message format
The result is that, there is no result becasue nothing is happend. My jms proxy service doesn't receive any message.
Someone knows how to fix that?
Maybe there is another way to do that?

Your JMS Proxy is configured to receive messages from a JMS queue or topic.
You should try to write a named sequence that send an appropriate message into your queue or topic. Then, configure your scheduled task to call this sequence :
injectTo = sequence
format = soap11 (for exemple)
soapAction = mySoapAction (if needed)
message = <root>myMessage</root>
sequenceName = YourSequenceThatSendTheMessageToJMS

Related

setting ack to client results in duplicate message delivery stomp

I have a stomp application and I set the ack mode to client during subscription from front-end. During the subscription the same client during a session would connect to the same queue in the message broker ActiveMQ Artemis because a session id is used for queue.But a different id is passed in the header every time the user reloads the page.
The subscription code is shown below.
consumer.subscribe(
'/queue.'+ rscSessionId,
function (response) {
console.log("resposne");
},
{
"subscription-type": "ANYCAST",
ack: "client",
id: generateId(),
}
);
Once I send message from client it gets send to frontend with following headers.
MESSAGE
subscription:1234
message-id:1543449
destination:/queue.sessionid
expires:1653914606725
redelivered:false
priority:4
persistent:true
timestamp:1653912806717
destination-type:ANYCAST
__AMQ_CID:30e64793-dd9b-11ec-8843-c238460c3152
_type:ResponseData
content-length:300
and afterwards on every reload.
MESSAGE
subscription:1235
message-id:1543449
destination:/queue.sessionid
expires:1653914606725
redelivered:true
priority:4
persistent:true
timestamp:1653912806717
destination-type:ANYCAST
__AMQ_CID:30e64793-dd9b-11ec-8843-c238460c3152
_type:ResponseData
content-length:300
You can see that redelivered is set to true after first delivery and after that every response has redelivered to false. the subscription value keeps getting changed though because of the id passed in header.
How can I make it deliver only once but with guarantee?
Are you actually acknowledging the message once you receive it? If you don't acknowledge the message then once the client closes the connection and subscribes again it will receive the same message again. The different value you're seeing for the subscription header indicates this is what is happening.
To be clear, if you're using the client acknowledgement mode then once you receive the MESSAGE frame you need to send a corresponding ACK frame in order to acknowledge the message. Your client should have a way to do this since it is a standard part of the STOMP specification.
I guess that Artemis is configured with publisher/subscriber messaging style. In this case, every new consumer/receiver/client will get the messages aka you write/read from a topic.
Changing to a point-to-point message style would fix the issue (would only be read once) aka a queue.
This is usually decided by the setup but I recall that ActiveMQ allowed producer to create those on the fly.
If you do need a topic, then you will have to handle the IDs on the client side.

org.apache.axis2.AxisFault: Translation error

I get the followwing exception when trying to read a SOAP response from a reply queue on IBM WAS 8.5:
Caught an AxisFault while executing the web service call [org.apache.axis2.AxisFault: Translation error]
org.apache.axis2.AxisFault: Translation error
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
I could not find anything related to this error by googling or on IBM's websites.
Looking at that Utils code in open source, "Translation error" is probably the message being sent back in a SOAPFault from the remote web service. Why the remote service is sending back a SOAPFault isn't apparent. If you turn on trace of org.apache.*=all:com.ibm.ws.websvcs.*=all you'll be able to see the incoming message in the trace and that might give you more information.
We were able to resolve this by un-cheking the option at
Queues > "Your Queue" > Advanced properties
[]Append RFH version 2 headers to messages sent to this destination

Callback in Outbound Gateway Spring Integration

I need to callback request after output of otbound gateway . My components :
Input Message -> Service Activator ->webservice OutBound Gateway -> Response Message
here I need to check response message and supply new message as input message which depends upon response code.
Your question is not clear; you should show the configuration you have tried.
You can simply add a reply channel to the gateway and add more processing after that channel.

Copying MQMessage MQMD values to JMS message

I have a requirement where I have to copy value of MessageID, correlationID, persistence, Expiry and Priority from request MQ message to response. I put the request message in the queue using RFHUtil . but as the message is consumed by the Session beans the messageID of MQMD header changes to some different value -HEXADECIMAL, which is different from the MessageID I put in RFHUTIL.
then I copy the above values from request to response message using set methods,- setJMSMessageID etc. but the values are different once I view the response message.
is this due to MQ to JMS conversion? what can be the solution to this.
Earlier I was using MQ Message and was able to copy all fields from request to response.
MessageID in IBM MQ is always hexadecimal, no matter from which API it is set, Base MQ or MQ JMS.
You don't need to set the MessageID while sending the request message. Let MQ do that for you. MQ will generate a unique message id for the request message. In your session beans, you simply copy the MessageID of the request message to CorrelationID of response message. This way you can correlate request and response messages.
See IBM WebSphere MQ request/reply scenario for more details.
UPDATE
Any value set using setMessageID method is ignored when the message is sent, but the method can be used to change the value in a received message.
As the message ID set by setMessageID method is ignored when a message is sent, an application cannot specify the message ID of an outgoing message. As a consequence, an application cannot receive a message and then forward the same message, or send a different message, with the same message ID as that of the message it has received. See the link:

how to add http header such as basic auth when retry the message from the JMS store using schedulemessageforwardprocessor?

I am using the new feature Message store and processor from ESB 4 for the reliable delivery.
The endpoint service requires basic auth (a http Authorization header) which I added during the in sequence through a property with scope of "transport".
the endpoint is defined as:
-1
1.0
It works when end point up running, the message will be sent with auth header from in sequence.
when the end point is down, the message will be saved to JMS message store.
The problem is when the message being retried by the ScheduleMessageForwardingProcessor, I don't know where/how to add the auth header, and without the auth header all the retry message will fail even when the endpoint is up again.
Your help will be highly appreciated.
Currently this is a limitation in WSO2 ESB Message Processors. We have added these features in the trunk ESB and they will be available in the next public release of WSO2 ESB.

Resources