How to get all the Queues in one node - rabbitmq

I want fetch the all the available Queues in the one machine using Java API(Spring-AMQP). I didn't find the right API. Can anyone suggest the API for the same.

You have to use the REST API for that; the AMQP protocol itself has no support for it.
Spring AMQP 1.5 (currently milestone 1) has a wrapper for the java REST client - RabbitManagementTemplate or you can use the java client provided by the rabbitmq team directly.

Below HTTP get call will list you all queue
http://localhost:55672/api/queues
List all queues under a particular vhost:
http://localhost:55672/api/queues/vhost_name
Refer the doc for more details.

Related

ActiveMQ topic send automatically

I have some subscribers that they are listening to "mytopic"...I send message to them by browser UI just like attached image
but now I want to do this work in code environment
what should I do and whats that code and methods?
-----> attached image
Thanks
You should have mentioned what programming language you want to use. Every language may offer a different API and specification.
In case of using Java, you can simply program according to the JMS specification
https://docs.oracle.com/javaee/7/api/javax/jms/package-summary.html
Also, the Apache ActiveMQ installation comes with a few examples that you can use as a reference. E.g. see
examples/openwire/swissarmy/src/TopicPublisher.java
You should have a look at ActiveMQ Protocols - for example you can use the ActiveMQ REST API to POST messages to the topic or use JMS.
Then you can look at how to use these from a "client" (presumably your central server) perspective.
For REST from Java (say) you could look at this article

How to modify spring-websocket to interface with broker via MQTT instead of STOMP?

I'm building a spring-websocket application that currently uses RabbitMQ as a message broker via the STOMP protocol. The rest of our organization mostly uses IBM Websphere MQ as a message broker, so we'd like to convert it away from RabbitMQ. However Websphere MQ doesn't support the STOMP protocol, which is spring-websocket's default. MQTT seems like the easiest supported protocol to use instead. Ideally our front-end web clients will continue to use STOMP, but I'm also OK with migrating them to MQTT if needed.
What classes do I need to overwrite to make spring-websocket interface with the broker via MQTT instead of STOMP? This article provides some general guidance that I should extend AbstractMessageBrokerConfiguration, but I'm unclear where to begin.
Currently I'm using the standard configuration methods: registry.enableStompBrokerRelay and registerStompEndpoints in AbstractWebSocketMessageBrokerConfigurer
Ryan has some good pointers.
The main work is going to be creating a replacement for StompBrokerRelayMessageHandler with an MqttBrokerMessageHandler that not only talks to an MQTT broker but also adapts client STOMP frames to MQTT and vice versa. The protocols are similar enough that it may be possible to find common ground but you won't know until you try.
Note that we did have plans for for MQTT support https://jira.spring.io/browse/SPR-12581 but the key issue was that SockJS which is required over the Web for fallback support does not support binary messages.
Here's my stab at this after reviewing the spring-websocket source code:
Change WebSocketConfig:
Remove #EnableWebSocketMessageBroker
Add new annotation: #EnableMqttWebSocketMessageBroker
Create MqttBrokerMessageHandler that extends AbstractBrokerMessageHandler -- suggest we copy and edit StompBrokerRelayMessageHandler
Create a new class that EnableMqttWebSocketMessageBroker imports: DelegatingMqttWebSocketMessageBrokerConfiguration
DelegatingMqttWebSocketMessageBrokerConfiguration extends AbstractMessageBrokerConfiguration directly and routes to MqttBrokerMessageHandler
Add this to server.xml on WebSphere Liberty:
<feature>websocket-1.1</feature>

Mule ESB and Throttling

IN the following link:
http://www.mulesoft.org/documentation/display/current/Mule+ESB+3.4.0+Release+Notes
I see the following
EE-3141 When using a Throttling policy with throttling statics enabled, limit headers are swapped.
However, I can find no example of throttling policies within Mule ESB, but there is possibly a throttling policy within the Anypoint API Manager
Could someone please provide a link to how to use a Throttling policy within Mule ESB?
Thanks
To achieve correct Throttling behaviour you can follow below steps:
Configure a queue (for example, a persistent VM or a JMS queue to avoid message lost during the Mule server crash) after your inbound endpoint.
Configure scheduled delay, for example AMQ_SCHEDULED_DELAY in case of ActiveMQ, to a desired value. If the queue does not support scheduled delay, then we need to find our way to achieve the delay, probably using a Java component.
Finally, configure the outbound endpoint.
The Throttling module (which can be configured as throttler or rate limiter) comes out of the box with any Mule API Gateway distribution. Mule EE comes with a light weight version of it. If you are using Anypoint API Platform, then you don't need to pay attention to the internals of how it is being done: Simply apply/unapply the policy to your managed API and it will work like a charm.
Even i tried implementing the Throttling concept in mule flows. There is no exact way of implementation for this , but i was able get that nature into the flows using the receiver thread profiling at inbounds and dispatch threading profiles on outbound connectors.

AMQP QPID client connector?

My next project is a RESTful application, so Restlet seems to be an excellent choice for implementation. However, I couldn't find any support for AMQP. What is the best way to add AMQP support, in particular QPID, to my project? I'm thinking of extending org.restlet.Client but not sure how to start. Any pointer is appreciated.
Thanks,
Khoa
QPID is a implementation of AMQP protocol - an ESB if u want or a server that you connect to. Usually you get connections to it through JNDI, or AMQPConnectionFactory (if I am not mistaken the name). Restlet has to do with Servlets. I can't see the connection between one and another to be honest. For example with Restlet you can map a HTTP GET to a certain path, but what you do after the GET (for example connecting to QPID) is totally your business.

What is the best alternative way of monitoring apache Active MQ other than using JMX API

I have tried and tested the JMX API and it is pretty simple to use and provides a vast number of statistics required for monitoring ActiveMQ.
But the problem is, i dont want to monitor my ActiveMQ remotely and also i dont want to use another API.To be more precise, i want to use the JMS API itself to get statistics related to various destinations and the broker itself.
Advisory messages seem to be an alternative but they provide limited Amount of Administrative Messages to monitor.
Any input is highly appreciated...
There is no built-in support for this. But you can implement a JMS topic which publishes the monitoring data every few seconds. Make the connection non-persistent so that it doesn't pile up when there are no listeners or when they loose connection.
Now you can write a client that connects to this topic and it will receive updates.
AMQ-2379 resulted in a broker plugin for grabbing statistics from destinations by sending a simple JMS message. Check out the docs that show how to use it here:
http://activemq.apache.org/statisticsplugin.html
The statistics plugin is available in the 5.3 release.
You can checkout this http://issues.apache.org/activemq/browse/AMQ-2379, it will be avaiable in upcoming 5.3.0 release
There's a blog post queued up to go on http://issues.apache.org/activemq/browse/AMQ-2379 - will post it in a couple of days or so