How to use HornetQ match patterns - jms

I'm using Jboss 7.1.1.final and I need to define 2 different DLQ's so that one queue would have DLQ1 and the other queues will have DLQ2.
I looked at HornetQ documentation and found the address_settings tag that have a match attribute:
<address-setting match="jms.queue.exampleQueue">
<dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address>
If i have a queue defined like:
<jms-queue name="Test">
<entry name="queue/Test"/>
</jms-queue>
What would be the match pattern for it? is it jms.queue.Test?
How can i see the messages in the DLQ? Do i have to write an MDB that listens to it or is it possible to see it in the admin console of jboss?

What would be the match pattern for it? is it jms.queue.Test? -->> yes, that's correct pattern. You can use JMS browser API for this or hornetq admin API

Related

Connecting ActiveMQ Web-Console to an existing broker (instead of starting a new one)

Having deployed the activemq-web-console war into a Tomcat embedded application how can one make it connect to an existing broker rather than create a new one?
The war comes with a set of predefined configurations, in particular, the WEB-INF/activemq.xml contains a configuration for the BrokerService
<broker brokerName="web-console" useJmx="true" xmlns="http://activemq.apache.org/schema/core">
<persistenceAdapter><kahaDB directory="target/kahadb"/></persistenceAdapter>
<transportConnectors>
<transportConnector uri="tcp://localhost:12345"/>
</transportConnectors>
</broker>
used from webconsole-embedded.xml in the following manner:
<bean id="brokerService" class="org.apache.activemq.xbean.BrokerFactoryBean">
<property name="config" value="/WEB-INF/activemq.xml"/>
</bean>
This configuration creates a new instance of BrokerService and tries to start the broker.
It is reported that the web console can be used to monitor an existing broker service rather than creating a new one. For this one should set the following properties somewhere:
webconsole.type=properties
webconsole.jms.url=tcp://localhost:61616
webconsole.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-trun
The questions is, where does one have to set these properties within the Tomcat embedded app and which XML changes in the above have to be performed for them to be used. I cannot find any sensible explanation how to configure it, and a BrokerService instance seems to be required by the remaining spring config.
Any ideas?
Please do not suggest to use hawtio instead!
I had the same problem today. You can start the webconsole in "properties" mode which gives you the oppertunity to connect over jmx.
I added following java arguments to our Jboss 6.1 and it worked immediatley. I didn't change any of the xmls (works out of the box)...
Example:
-Dwebconsole.type=properties -Dwebconsole.jms.url=tcp://<hostname>:61616 -Dwebconsole.jmx.url=service:jmx:rmi:///jndi/rmi://<hostname>:1090/jmxrmi -Dwebconsole.jmx.user=admin -Dwebconsole.jmx.password=123456
Also discussed here: https://svn.apache.org/repos/infra/websites/production/activemq/content/5.7.0/web-console.html

JMS server details of a JMS connector encapsulated inside a composite connector

I have a composite source enclosing Multiple jms end connector... I want to know which endpoint within composite source received the message . Note: inbound property does not have end point details. Basically,I want to get the JMS server address ... Or the server address what i have given in the jms endpoint will also be enough.
Got this solution refering to mulesoft documentation:
<composite-source doc:name="Composite Source">
<jms:inbound-endpoint queue="${jms1.queue}"
connector-ref="jms-connector1" doc:name="JMS1">
<set-property propertyName="source" value="jms1"></set-property>
</jms:inbound-endpoint>
<jms:inbound-endpoint queue="${jms2.queue}"
connector-ref="jms-connector2" doc:name="JMS2" >
<set-property propertyName="source" value="jms2"></set-property>
</jms:inbound-endpoint>
</composite-source>

creating shovels through spring xml

Using spring XML, just like we create queues, binding etc as below
<rabbit:queue name="TestQueue" />
<rabbit:topic-exchange name="TestExchange">
<rabbit:bindings>
<rabbit:binding queue="TestQueue" pattern="Test.Key" />
</rabbit:bindings>
</rabbit:topic-exchange>
Can we also create shovels?
Please let me know. i want to create dynamic shovels automatically. Not manually through management plugin.
Can we also create shovels?
No; Spring-AMQP provisioning is limited to what you can do over the AMQP protocol (exchanges, queues, bindings).
RabbitMQ provides a REST API which can be used for other provisioning.
They provide a Java binding for the API.

read message from queue/topic in mule

I want to implement a consumer kind behaviour using Mule, ActiveMQ which can read JMS messages....there is some third party queue/topic. need to subscribe to them and start listening. How can I achieve that in mule?
Follow the instructions in this blog post to get a working connector. If you are using JMS1.1 you don't even need to specify queue or topic, they will behave the same. If you are using 1.0b, please make sure you specify the correct type.
Then, instead of using an outbound endpoint use an inbound endpoint:
<jms:inbound-endpoint topic="myTopic" connector-ref="Active_MQ" />
I do, however, recommend to use Anypoint Studio, that will provide you a very simple interface for this kind of configurations.
To read a message from activemq queue ot topic, can simply put in your flow for example:
<flow name="insert-operation" doc:name="insert-operation" doc:description="">
<jms:inbound-endpoint connector-ref="Active_MQ" exchange-pattern="request-response" queue="insert-jms" doc:name="JMS">
<idempotent-redelivery-policy idExpression="#[message.inboundProperties['JMSMessageID']]" />
<xa-transaction action="ALWAYS_BEGIN" />
</jms:inbound-endpoint>
...
</flow>

Spring Integration :Can we have two Inbound Channel in the same time

I am using
<int:inbound-channel-adapter id="dummyMessageA" channel="messages" method="getMessage" auto-startup="true" ref="messageGenerator">
<int:poller error-channel="errorChannel" fixed-rate="10000"/>
</int:inbound-channel-adapter>
<int:inbound-channel-adapter id="dummyNotif" channel="notifs" method="gtNotif" auto-startup="true" ref="notifGenerator">
<int:poller error-channel="errorChannel" fixed-rate="10000"/>
</int:inbound-channel-adapter>
These inbound channels are independent but when I deploy my Web Application, Only the second inbound channel adapter is taken into consideration (although the other one was working before adding the dummyNotif). Is this normal, should I add something in the config (NB : I don't aggregate the messages)
My guess you catched this issue https://jira.spring.io/browse/INT-3240 - 'Inbound Channel Adapter Parser doesn't generate unique bean Id for MessageSources'. That's mean that you use Spring Integration 3.0.
So, just upgrade to the latest - 3.0.2.RELEASE - and let us know.
UPDATE
Regarding the same id for several beans. By default Spring allow to do it and the last bean wins. All others will be ignored and skipped.
It can be disabled by AbstractRefreshableApplicationContext#setAllowBeanDefinitionOverriding(false).
From other side if you setup DEBUG logging level for org.springframework category you'll the message in the logs that your beans are overriden.
as far as your question is concerned, Spring Integration allows to have multiple inbound-channel-adapter definition in a single context.
However, from your comments, seems that you have some different issue in your configuration multiple Service Activators with same Id.
It can be disabled as #Artem described in his answer.

Resources