ActiveMQ: how to get consumer IP address - activemq

In my project we are using Apache ActiveMQ to transfer messages between server and clients. We are using the MapMessage class to get the all consumer details. In the reply ActiveMQ returns all the statistics (ActiveMQ.Statistics.Subscription) like connectionid, selector, clientId, destinationName etc. But I'm not getting the IP address of the consumer. Is there any way to get the consumer IP? I can see the IPaddress of the consumer in the web console but we wanted to get this information in the server code.

There is currently no way to get the consumer's IP address from the message returned by the broker's statistics plugin.

Related

Activemq topic subscribers doubles the messages

I have an application in weblogic clustered environment. There are 2 servers in this cluster. I want to use durable subscription so for each server I needed to give different clientId. ClientIds should be unique for server. But when I receive message It doubles this way. I want to make group of these clients and use as queue. This way if one of the server get the message then the other will not get any message. How can I achieve this? Using queue is forbidden. I need to use topic.
Edit: I use Weblogic as application server. My application is basic Spring JMS listener.

find where activemq is running

I am starting to study ActiveMQ, and there is one question that I must have the answer as soon as possible: is it possible for a, say, console program, to know the IP of the machine where ActiveMQ is running without any previous information, like configuration file, or a parameter passed to the program? I wonder if ActiveMQ answers to some type of broadcast network message, reporting the IP of the computer it is running.
Thanks!
While your question is a bit vague on actual requirements and network capabilities etc, the most reasonable answer to this is to use discovery via multicast to locate a broker to connect to. There is documentation for this here, here, here and some here and more if you bother to search Google.
When you enable discovery on the broker's transport connector it will broadcast via multicast the IP address and port where a client can connect. You should do some research and even browse the ActiveMQ code to see how this works.
No, that's not possible. If all of the world's ActiveMQ servers were broadcasting their connection info to every producer or consumer in the world, that would be a ton of traffic. And if they were, how's a producer of consumer supposed to know which one to connect to, without being told? You have to tell the client how to reach the broker, and it's not a big deal to do.

How can I Use RabbitMQ between two application while I can't change one of them?

I have an existing system consisting of two nodes, a client/server model.
I want to exchange messages between them using RabbitMQ. I.e. The client would send all its requests to RabbitMQ and the server would listen to the queue indefinitely, consume any messages that arrives and then act upon it.
I can change the server as needed, but my problem is, I cannot change the client's behavior. How can I send back the response to the client?
The client node understands HTTP request/response, what shall I do after configure the other application server to RabbitMQ instead of my app directly.
You can use RPC model or some internal convention, like storing result in database (or cache) with known id and polling your storage for that result in a cycle
You will have to use a proxy server in between that will seem to node 1 (the client you cannot change) as the actual server while it just inject requests into the queuing server. You will also have to use 2 queues.
For clarity, let's enumerate the system players:
The client
The proxy server, a server that offers the same API offered by the actual (but it doesn't do any work)
The actual server, the server that does the actual work
The input queue, the queue where clients requests go into (proxy server does that)
The output queue, the queue where server responses go into (actual server does that)
A possible working scenario:
A client sends a request to the proxy server
The proxy server puts the request in input queue
The actual server (listening to the input queue) will fetch the request
The actual server process the message
The actual server sends the response to the output queue
The proxy server (listening to the output queue) will fetch the response
The proxy server returns the response to the client
This might work, but few problems could happen, e.g. because the proxy server doesn't know when the actual server will response, and, it cannot be sure of the order of responses in the output queue, it may have to re-inject the messages it finds not relevant to the output queue until it finds the correct message.
Or, the proxy server might need to feed the response to the client later via an HTTP request to the client. That is, rather than a response to the client's request, the client will expect no response for the request it sent knowing that it will be get the answer later via a request from the proxy server.
I'm not aware of the situation at your end, but this might work!

How to publish message from WSO2 ESB to RabbitMQ?

I am trying to configure wso2 esb with rabbitmq. I've read this article.Whenever i sent a message from the sender , It reached out the queue named Q1 as well as ESB console. But it doesn't reach queue named Q2.
Does anybody has a solution ?
thanks
According to the provided end-point all messages should publish to the queue test via test exchange. You can introduce rabbitmq.queue.routing.key property to your endpoint and bind your test queue to test exchange using that route key.
If you have already configured axis2.xml/proxy service correctly according to the documentation[1], there can be a configuration issue at your RabbitMQ server side.You can confirm that writing a simple java client according to the article[2] or refer this tutorial[2].
Or you may remove test-queue/test-exchange from RabbitMQ server and try your endpoint.
[1]. http://docs.wso2.org/display/ESB460/RabbitMQ+AMQP+Transport
[2]. http://www.rabbitmq.com/tutorials/tutorial-one-java.html

Cannot send message to MSMQ queue when destination server's domain name is specified

I have a wcf msmq service. I try to send a message to it. Delivery fails is I specify server's domain name in endpoint address. If it contains ip or netbios name - everything is fine. I am able to ping the sever by it's domain name. DNS server is also reachable and has the needed entry. The messages are left in the system dead-letter queue. Any workarounds?
The client and the service are on the same machine. And it really seems like the message is really delivered, but the queue lookup fails. When I open destination queue properties I see that the queue name is comp_name\private$\my_queue. The messages in dead queue have destination comp_name**.com**\private$\my_queue. May be this is it?