I need to consume WS that's using JMS as a transport rather than HTTP.
The Web Service Consumer doc says that it supports JMS but no any example provided unfortunately of using the component with non HTTP transports.
Need help with this subject. These are the steps I've done:
The wsdl has been successfully loaded by the connector wizard in anypoint. I've specified the method to be called. The parameters were recognized by DataSense so I can see the input parameters with DataMapper etc.
The URL looks like this: jms:queue:toOrderManagement?replyToName=fromOrderManagement?targetService=OrderManagement
I've defined global JMS connector like this:
<jms:connector name="JMSConnector" specification="1.1" username="user"
password="******" validateConnections="true" doc:name="JMS">
<reconnect-forever />
</jms:connector>
and associated it with the WS connector like this:
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="myOrder.wsdl"
service="OrderManager" port="JMSOrderManager"
serviceAddress="jms:queue:toOrderManagement?replyToName=fromOrderManagement?targetService=OrderManagement"
doc:name="Web Service Consumer" connector-ref="JMSConnector"/>
So, how to specify the actual JMS queue name and what the format of the serviceAddress attribute when it's configured for JMS/WS?
Ok, it took me some time to get the answer on this.
So, first, the format of the servcieAddress should be like this:
jms://${toQueue}?exchangePattern=request-response
where toQueue is the "request" queue name i.e. the one the request will be sent to.
Now, if you don't specify any additional parameters, a temporary "response" queue will be automatically created and WS Consumer will be waiting for receiving the response from it.
If you wanna use a pre-configured queue for getting responses then, before calling the WS Consumer, you need to set the message property JMSReplyTo with the response queue name to be used. If the property is set then WS Consumer will wait for the response from that queue rather than from the temporary one.
Related
I'm trying to read messages from ActiveMQ Artemis using JMeter. For that I use JMS Subscriber. For some reason I can't read messages, it gives me an 404 response code. I think that I'm making everything correct, but it doesn't works. Here is what have I done.
and here is the response.
my ActiveMQ looks like that:
The problem was in Destination field. I should have use dynamicQueues/GDE.Error instead of dynamicTopics/GDE.Error .
is it possible to make the ActiveMQ broker distribute messages received on one transportConnector to other transportConnectors as well?
The concrete use case is this: I have a Java client sending messages using the openwire transportConnector and I would like to be able to read them on the mqtt transportConnector.
I use the sample jndi.properties file that is on the ActiveMQ page http://activemq.apache.org/jndi-support.html:
java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
# use the following property to configure the default connector
java.naming.provider.url = tcp://localhost:61616
# use the following property to specify the JNDI name the connection factory
# should appear as.
#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.MyQueue = example.MyQueue
# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.MyTopic = example.MyTopic
I had to replace the default 'vm' transportConnector with the 'tcp' one because it did not execute using 'vm'.
The messages are pushed to my Java MessageListener instance but my mqtt client does not show them. I tried with different topics, started with 'example.MyTopic' up to '/example/MyTopic'.
Any help would be much appreciated.
Many thanks,
Roman
The broker does that by default so you are not doing something right, check the admin console for producers and consumer registered on the given destinations to see what is going on. You must remember that a Topic consumer will not receive messages sent to that Topic unless it was online at the time they were sent or you had previously created a durable topic subscription.
I have wrote server-client application.
Server Side
server will initilise a queue queue1 with routing key key1 on direct exchange.
After initilise and declaration it consume data whenever someone write on it.
Client Side
client will publish some data on that exchange using routing key key1 .
Also i have set mandotory flag to true before i publish.
Problem
everything is fine when i start server first .but i got problem when i start client first and it publish data with routing key. When client published data there is no exception from broker.
Requirement
I want exception or error when i published data on non existing queue.
If you will publish messages with mandatory flag set to true, then that message will returned back in case it cannot be routed to any queue.
As to nonexistent exchanges, it is forbidden to publish messages to non-existent exchanges, so you'll have to get an error about that, something like NOT_FOUND - no exchange 'nonexistent_exchange' in vhost '/'.
You can declare exchanges an queues and bind them as you need on client side too. These operations are idempotent.
Note, that creating and binding exchanges and queues on every publish may have negative performance impact, so do that on client start, not every publish.
P.S.: if you use rabbitmq-c, then it is worth to cite basic_publish documentation
Note that at the AMQ protocol level basic.publish is an async method:
this means error conditions that occur on the broker (such as publishing to a non-existent exchange) will not be reflected in the return value of this function.
I spend a lot time to find do that. I have a example code in python using pika lib to show how to send messsage with delivery mode to prevent waiting response when send message to noneexist queue(broker will ignore meessage so that do not need receive response message)
import pika
# Open a connection to RabbitMQ on localhost using all default parameters
connection = pika.BlockingConnection()
# Open the channel
channel = connection.channel()
# Declare the queue
channel.queue_declare(queue="test", durable=True, exclusive=False, auto_delete=False)
# Enabled delivery confirmations
channel.confirm_delivery()
# Send a message
if channel.basic_publish(exchange='test',
routing_key='test',
body='Hello World!',
properties=pika.BasicProperties(content_type='text/plain',
delivery_mode=1),
mandatory=True):
print('Message was published')
else:
print('Message was returned')
Reference:
http://pika.readthedocs.org/en/latest/examples/blocking_publish_mandatory.html
I'm trying to switch from ActiveMQ 5.6 to Apollo 1.5.
I have two soft that are exchanging messages, using publish/subscribe on topics.
The first one is c++ and use openwire with tcp
The second one is Javascript and use stomp with websockets
With ActiveMQ everything worked fine, and the messages I sent could be read and write on both softs, and I didn't changed the clients since.
Now, I send messages from the c++ soft (using openwire), and try to read them with the JS soft, and I get errors. In fact I receive message with header content-type: "protocol/openwire", but I expect stomp.
this is how I configured apollo.xml connector section :
<connector id="tcp" bind="tcp://0.0.0.0:61613">
<openwire max_inactivity_duration="-1" max_inactivity_duration_delay="-1" />
<stomp max_header_length="10000" die_delay="-1" />
</connector>
<connector id="ws" bind="tcp://0.0.0.0:61623">
<stomp max_header_length="10000" die_delay="-1" />
</connector>
I also tried with <detect /> in tcp and ws connector, that is supposed to auto detect client protocol, but dosen't work either.
Does someone can help me to figure this out ?
Thank you,
edit :
I found out that I do receive stomp protocol messages, but they are very weirdly formated, and even contains non text char that make stomp.js fail to parse the message and correctly fill the message body.
here are the same message received once from activemq openwire and then apollo openwire in with the same c++ publisher and js subscriber :
activemq
"MESSAGE
message-id:ID:myID-61443-1352999572576-0:0:0:0:0
class:Message.PointToPoint
destination:/topic/my-topic
timestamp:1352999626186
expires:0
subscription:sub-0
priority:4
<PointToPoint xmlns="Message" ><SourceId>u_23</SourceId><TargetId>u_75</TargetId></PointToPoint>"
apollo
"MESSAGE
subscription:sub-0
destination:
content-length:331
content-type:protocol/openwire
message-id:xps-broker-291
Eç{#ID:myID-61463-1352999939140-0:0emy-topicn{#ID:myID-61463-1352999939140-0:0; Å??<PointToPoint xmlns="Message" ><SourceId>u_23</SourceId><TargetId>u_75</TargetId></PointToPoint>(class Message.PointToPoint
"
Do you think it could be a problem in Apollo ?
ActiveMQ 5.6 handles translating the logical OpenWire messages into a text representation for STOMP clients. Apollo, currently does not support that feature yet! :( See:
https://issues.apache.org/jira/browse/APLO-267
It just takes the full openwire message and uses it as the body of the STOMP message. BTW using binary data in a STOMP message is totally valid as long as the content-length header is properly set.
i am creating one webservice in mule using cxf:jaxws-service. This is the url :http://localhost:65042/InsertDocService/InsertDoc, i am ablie to generate WSDL file, but i want to consume this service in mule using cxf:jaxws-client.
<flow name="documentumclientflowFlow1" doc:name="documentumclientflowFlow1">
<inbound-endpoint address="http://localhost:65042/InsertDocumentumService/InsertDocumentum" doc:name="Generic"/>
<cxf:jaxws-client operation="insertDocumentum" serviceClass="com.integration.IDocumentumInsert" port="80" mtomEnabled="true" enableMuleSoapHeaders="true" doc:name="SOAP"/>
<outbound-endpoint address="http://locahhost:65042/InsertDocumentumService/InsertDocumentum" doc:name="Generic"/>
</flow>
if i invoke this, it's going to Service project and getting erorr like"org.apache.cxf.interceptor.Fault: No such operation: (HTTP GET PATH_INFO: /InsertDocumentumService/InsertDocumentum)". Please any one suggest me how can i solve this issue and how can i consume this service.
Besides the type (locahhost instead of localhost), it looks like you're trying to use the same address in the outbound endpoint than in the inbound one. I don't think this is what you want to do, as it will lead to a looping re-entrant call that will eventually exhaust the pool threads, block, time out and die in a fire.
So what do you want to do with "documentumclientflowFlow1"? It is unclear from your question.