How to enable scheduler in ActiveMQ Artemis - jms

The ActiveMQ documentation mentions this:
ActiveMQ from version 5.4 has an optional persistent scheduler built into the ActiveMQ message broker. It is enabled by setting the broker schedulerSupport attribute to true in the Xml Configuration.
Please help me where I can find this file to update this property.

The documentation you cited is specifically for ActiveMQ "Classic" (i.e. 5.x and prior). It does not apply to ActiveMQ Artemis.
There is no need to configure anything for scheduled message support in ActiveMQ Artemis. It works out-of-the-box. You can read more about scheduled message support in the ActiveMQ Artemis documentation.

You enable scheduler support by adding the schedulerSupport attribute to the tag
<broker .. schedulerSupport="true" ..
ref: Scheduler Support documentation

Related

Apache ActiveMQ - retrieving JMS metrics

In my corporate project I am using Spring Boot and Apache ActiveMQ 5.x Spring Boot starter. I am a totally beginner in this.
My goal is to expose Prometheus endpoint with some JMS queue metrics:
number of messages in queue
number of messages in error queue
What are dedicated tools for retrieving such metrics? Up to now I have found two possible ways. Can anyone confirm which of these two tools can solve my problem?
https://docs.spring.io/spring-integration/docs/5.1.7.RELEASE/reference/html/#system-management-chapter
https://activemq.apache.org/components/artemis/documentation/latest/metrics.html (here the example is not very helpful)
I don't think the Spring stuff will work because that will provide Spring-related metrics from the application itself, not the ActiveMQ broker.
Also, the documentation for ActiveMQ you cited is for ActiveMQ Artemis. However, the dependency you're using is for ActiveMQ 5.x. Therefore, the documentation is not applicable. However, if you choose to use ActiveMQ Artemis it is very simple to expose a Prometheus endpoint using this Prometheus metrics plugin implementation. It's worth noting that Artemis is ActiveMQ's next generation message broker. If you're starting a new project I would recommend you use it rather than 5.x. Artemis is planned to replace 5.x and become ActiveMQ 6.0 in the future.
I think your best bet would be to configure the Prometheus JMX exporter. It even has a sample configuration for ActiveMQ 5.x.
ActiveMQ comes with Jolokia bundled by default for extracting JMX Beans for the JVM, queues and a bunch of other metrics using HTTP. That way we can easily export using a software like Telegraf, which comes with a simple input plugin for ActiveMQ and a simple output plugin for Prometheus.

How to bridge between IBM MQSeries and ActiveMQ Artemis 7.x?

Has anyone succeeded in creating a bridge between IBM MQSeries (MQS) and ActiveMQ Artemis 7.x (AMQ 7) so that the later can send messages to and receive from the first? Currently I have no problem bridging between MQS 7.5 and AMQ 6.3 by deploying a camel route and MQS libraries on the broker itself. However, the same way doesn't work anymore as each route deployment requires a broker reconfiguration and restart.
Thanks in advance for any feedback.
A few examples ship with ActiveMQ Artemis which might be helpful:
The "inter-broker-bridge" example in the examples/features/sub-modules/ directory. This example demonstrates how to deploy an instance of org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl to the broker using Spring in a web application.
The "camel" example in the examples/features/standard/ directory. This example demonstrates how to deploy a Camel route to the broker using Spring in a web application.
I can't speak to whether or not either of these can be updated at runtime as I've not actually attempted that. Both of these options should be able to move messages in either direction (i.e. from Artemis to MQS or from MQS to Artemis).
Another option would simply be to run Camel standalone and deploy your routes there. This would give you more flexibility as it would allow you to specifically choose the hardware where the routes run as well as how many resources the Camel JVM consumes. Running Camel routes directly on the broker, while convenient, isn't a great fit because the broker is a broker and not an application server.
To be clear, ActiveMQ Artemis and IBM MQSeries are not directly compatible with each other and are not expected to be. This true for most (if not all) JMS broker implementations. The role of components like the ActiveMQ Artemis JMS bridge and integration platforms like Camel are to solve the compatibility problem by using a common API to speak to both brokers - JMS in this case. Any broker which implements JMS can be integrated using these methods.

Not able to configure JMS 2.0, ActiveMQ 5.x, and Karaf

I have been trying to setup pax-jms with ActiveMQ in Apache karaf. Following are the respective versions, that I have installed:
activemq-osgi: 5.15.3
OPS4J Pax JMS * : 1.0.3
Karaf: 4.2.0
JMS API: 2.0.1
These are the features that I had installed:
> feature:repo-add mvn:org.ops4j.pax.jms/pax-jms-features/1.0.3/xml/features
> feature:install pax-jms-activemq pax-jms-config
I can see that my configurations are being picked up properly. Thus, executing the command jms:connectionfactories shows the connection that I had configured.
Note: I followed https://ops4j1.jira.com/wiki/spaces/PAXJMS/pages/331350050/Configuration, believing that the steps would have been similar for ActiveMQ as well.
My configuration looks as follows:
jms.url=tcp://localhost:61616
jms.username=system
jms.password=manager
type=activemq
osgi.jndi.service.name=jms/demo.consumer
For the time being, I just wanted to test whether or not I can query the ActiveMQ broker from Karaf. Thus, I tried jms:info jms/demo.consumer. But, I am consistently getting the following error message:
Error executing command: JMS 2.0 is not supported by ActiveMQ
I have tried changing the versions, tried on fresh karaf instances as well. But, I had no luck so far. Am I missing some fundamental steps here?
The pax-jms-activemq module support ActiveMQ 5.x. The command line tools may not work b/c it calls ConnectionFactory.createContext() instead of .createConnection(). JMS v2.0 has a couple features that ActiveMQ 5.x does not support-- shared durable subscriptions, basically.
As long as the code that gets the ConnectionFactory calls .createConnection() instead of .createContext() it'll work just fine with the JMS API 2.0 jars. Java code, camel-activemq, camel-jms, etc will all work fine.
The error message is accurate. ActiveMQ 5.x doesn't support JMS 2.0. This isn't a configuration issue. It's simply not implemented. If you want JMS 2.0 support from an ActiveMQ broker then you should use ActiveMQ Artemis. For what it's worth, the documentation you referenced is using ActiveMQ Artemis.

Configure hornetq on Wildfly8 to send messages on JMS queue

I have recently started using Wildfly 8 and noticed that Wildfly8 has a built-in JMS utility called Hornetq. My question is, how can I configure hornetq to send and receive message on a JMS queue using Wildfly8 server?
There are a number of good tutorials on the net about how to use HornetQ (JMS) from within Widlfly, I like this one for JMS 2.0:
http://www.mastertheboss.com/jboss-server/jboss-jms/jms-20-tutorial-on-wildfly-as
Here is the hello world example from Wildfly themselves, illustrating how to implement an MDB and the respective listeners and topics:
https://github.com/wildfly/quickstart/tree/8.x/helloworld-mdb
That page describes everything in excellent detail and demonstrates the use of JMS 2.0 and EJB 3.2 Message-Driven Bean in WildFly 8. The project is runnable with maven and creates two JMS resources:
A queue named HELLOWORLDMDBQueue bound in JNDI as java:/queue/HELLOWORLDMDBQueue
A topic named HELLOWORLDMDBTopic bound in JNDI as java:/topic/HELLOWORLDMDBTopic
If you are having trouble with configuration of queues etc. in the standalone, the docs here are actually quite helpful as well:
https://docs.jboss.org/author/display/WFLY8/Messaging+configuration

Scheduled delivery of messages in IBM MQ

I am using IBM MQ & active mq in my application using Spring jms. I have a requirement to schedule a message for redelivery after x seconds.
I am able to achieve it in Active mq by setting the AMQ_SCHEDULED_DELAY header. This makes the message to get delivered to the queue after a specified number of seconds.
Is there anything similar in IBM MQ that I can use to achieve the above mentioned functionality ?
Any help is appreciated.
Well JMS 1.1 specification does not mention anything about delayed delivery of a message. Hence you don't have that feature in WMQ. Just released JMS 2.0 specification describes this feature.
yeah, WMQ isn't the best JMS impl for that sort of thing. Take a look at apache camel. It can provide this sort of delayed message routing.

Resources