Tuesday December 13, 2016

Fast Messaging With Apache ActiveMQ Artemis

First, what is Apache ActiveMQ Artemis

Apache Artemis is a sub project of ActiveMQ, where we are developing a new broker using 100% asynchronous back end. Messages are through a fast Journal Storage or through its Paging System when messages are beyond the capacity of the memory.

It was based on the donation from HornetQ, but it has evolved a lot since it joined the Apache ActiveMQ community, both evolving as a software and as an open source community

You can do either very fast messaging without using transactions, or you can use its mature transaction API (XA or regular transactions)

On this blog entry here I will cover how you can send thousands of messages per second by sending them asynchronously. Since there are many users interested in not using a transaction at all these days.

This is a guide to how to make your producers and consumers fly with Artemis

Many users have been using message systems that will favor performance instead of full guarantees of writes.

This is something we have been doing for years with the Artemis codebase, including Artemis and previous versions of HornetQ.

This is a small tutorial to do such thing with Artemis, pretty simple and quite powerful.

This will make sender to be 100% asynchronous, So you never block the producer and you can easily make thousands messages / second.

Even still the guarantees are quite high as the message will be persisted at the journal within milliseconds.

So, here is how you do it:

  • Disable Block on Persistent Messages:

There are two ways you can do that:

I - Disable blockOnDurableSend through a property:

ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();

II - Disable blockOnDurableSend through the URI for the connection Factory:

ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616?blockOnDurableSend=false);

  • Send non Transactionally:

A transaction means a hard sync on the world. Make a round trip to the server and sync on disk.
If you send a regular Persistent Message, asynchronously, then you get a large throughput on your producers.

Here is a full example:
package org.apache.activemq.artemis.cli.commands.messages;

import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.MessageProducer;
import javax.jms.Session;

import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;

public class FastProducer {

   public static void main(String arg[]) {
      try {
         ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616?blockOnDurableSend=false");
         Connection connection = factory.createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         Destination queue = ActiveMQDestination.createDestination("queue://TEST", ActiveMQDestination.QUEUE_TYPE);
         MessageProducer producer = session.createProducer(queue);

         long time = System.currentTimeMillis();

         for (int i = 0; i < 100000; i++) {
            producer.send(session.createTextMessage("hello guys"));

         System.out.println("Send message in " + (System.currentTimeMillis() - time) + " milliseconds");

      catch (Exception e) {


With this little example here I am able to send 100K messages in less than 2 seconds using my laptop.

Send message in 1772 milliseconds

And we are still improving things. Watch out for more improvements over the next month :)


Hi. Thank you for the information.

Posted by nicfaust on February 14, 2019 at 12:12 PM UTC #

Finally I got my piece of work from here. I recently got help from source. I really need this compiling software because there is a lot of programs that I have to make for my clients.

Posted by Henry on June 26, 2019 at 11:17 AM UTC #

Hello everyone if you are connect the right information are available on this post this is the perfect solution of the more time.

Posted by command prompt windows on June 29, 2019 at 09:16 AM UTC #

The questioner which you have created is the best guide for the Apache beginners to understand it perfectly. You tried to cover almost everything and I read blog for switching from android to iPhone due to more Apache options.

Posted by Rebecca on July 02, 2019 at 12:43 PM UTC #

I'd like to see more about economics like at this blog.

Posted by Harold on July 11, 2019 at 07:19 AM UTC #

Great One Love IT! Really love this work! Unique project

Posted by doxiciclina on July 19, 2019 at 07:47 PM UTC #

A very nice blog, I like the way you share very honestly and interestingly, through my blog I learned a lot of things.

Posted by wings io on August 21, 2019 at 05:04 AM UTC #

Thank for the useful information. The topic is forever actual and people will never stop exploring. Do you ever try to gamble with ClickandBuy on ipayzz ? It is an online service that provides many gambling-related information for you. You can read casino reviews and some useful casino tips.

Posted by Edward Hodgson on August 28, 2019 at 08:29 AM UTC #

I like how this guide will make your gaming and consumers fly with the Artemis game.

Posted by leonard on October 04, 2019 at 10:34 AM UTC #

The post is interesting. It explores Apache ActiveMQ Artemis. The content looks at the fast messaging with Apache ActiveMQ Artemis and Apache Artemis is a subproject of ActiveMQ, where they are developing a new broker using a 100% asynchronous back end.

Posted by Essays Chief on October 15, 2019 at 04:40 AM UTC #

Apache Artemis is good source for paging or large messaging. This platform for message system provides an ease. It is a most powerful and popular open source message broker. We are also using platform in my company for sending large messages via emails. It helps in fast messaging without using transactions.

Posted by Patricia Sperry on October 15, 2019 at 07:33 AM UTC #

Helpful post. Thank you so much for posting it.

Posted by Windows Tips on October 19, 2019 at 12:22 PM UTC #

The post is interesting. It explores fast messaging with Apache ActiveMQ Artemis. It mentions that Apache Artemis is a subproject of ActiveMQ, where we are building up a new broker using a 100% asynchronous back end. Messages are through a fast Journal Storage or its Paging System.

Posted by Essays Chief on November 05, 2019 at 06:14 AM UTC #

This article is really contains lot more information about This Topic. We have read your all the information some points are also good and some usually are awesome. Great post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article.

Posted by extraessay on November 09, 2019 at 09:04 PM UTC #

Web Hosting and Domain Registration are two elements of running a website. But it's important to understand the difference and use cases. Web Hosting is an account on a computer (aka server) that can store and serve website files via the Internet. ... As an analogy, a domain is an “address” on the Internet.

Posted by Sam Martin on January 02, 2020 at 10:39 AM UTC #

Is it okay to post part of this on my website basically post a hyperlink to this webpage?

Posted by johns on February 15, 2020 at 01:53 PM UTC #

Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing. cách tính giá từ khóa seo

Posted by osama shk on February 16, 2020 at 02:17 PM UTC #

thanks for the support

Posted by soluzioni brain out on February 16, 2020 at 08:23 PM UTC #


Posted by brain test on February 16, 2020 at 08:25 PM UTC #

Wow what a Great Information about World Day its very nice informative post. thanks for the post.

Posted by My Hero Academia merchandise on February 18, 2020 at 03:31 PM UTC #

Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.

Posted by on February 19, 2020 at 01:12 PM UTC #

Your website is really cool and this is a great inspiring article. Thank you so much. <a href='https://redmoonpie'>RedMoonPie</a>

Posted by farhanMalik on February 20, 2020 at 01:09 PM UTC #

Post a Comment:
Comments are closed for this entry.



Hot Blogs (today's hits)

Tag Cloud