DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Next Evolution in Integration: Architecting With Intent Using Model Context Protocol
  • Integrating Google BigQuery With Amazon SageMaker
  • Optimizing Integration Workflows With Spark Structured Streaming and Cloud Services
  • Docs That Write Themselves: Scaling With gRPC and Protobuf

Trending

  • How to Submit a Post to DZone
  • DZone's Article Submission Guidelines
  • Vibe Coding With GitHub Copilot: Optimizing API Performance in Fintech Microservices
  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 1
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. ActiveMQ Integration in Mule and Performance Tuning Techniques

ActiveMQ Integration in Mule and Performance Tuning Techniques

Learn how to integrate the ActiveMQ message broker with Mule, plus some tips on tuning ActiveMQ performance for better speed and efficiency.

By 
Rajesh Kumar user avatar
Rajesh Kumar
·
Nov. 15, 17 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
8.1K Views

Join the DZone community and get the full member experience.

Join For Free

ActiveMQ is one of the popular open source messaging providers. Mule is one of the most famous integration providers, which provides an ESB feature and framework to expose/create API mechanisms. Mule provides a connector to integrate easily with ActiveMQ and supports JMS 1.1 and J2SE 1.4 specifications.

Here, we will talk about the basic integration of ActiveMQ with Mule and performance tuning techniques. ActiveMQ configuration needs to be done using the JMS connector, which comes default in AnyPoint Studio.

Integration Steps

Drag and drop the JMS connector from the design palette in Anypoint Studio.

Image title

For connector configuration, use <jms:activemq-connector> or <jms:activemq-xa-connector> (to support XA transactions), like so:

<jms:activemq-connector name="jmsConnector"
                          brokerURL="tcp://localhost:61616"/>
  <jms:activemq-xa-connector name="jmsXAConnector"
                             brokerURL="tcp://localhost:61616"/>

Active MQ Connector Reference:

Click on "Connector configuration" and add the ActiveMQ information.

Image title

Refer to the documentation for more information on connector configuration.

Performance Tuning

When ActiveMQ message producer sends a non-persistent message (async publishing), it's dispatched asynchronously (fire then forget), but in the case of persistent messages, the publisher will block until it gets a notification that message has been processed by the broker.

Messages are dispatched with the delivery mode set to be persistent by default, so if you are sending messages on a topic, the publisher will block by default (even if there are no durable subscribers on the topic) until the broker has returned a notification.

So if you looking for good performance with topic messages, either set the delivery mode on the publisher to be non-persistent or set the "useAsyncsend" property on the ActiveMQ ConnectionFactory.

What Is the Preferred Pre-Fetch Size for Consumers?

ActiveMQ has the capability to push as many messages to the consumer as fast as possible, where they will be queued for processing by an ActiveMQ session. Here, pre-fetch configuration is very important based on the consumer.

The maximum number of messages that ActiveMQ will push to a consumer without the consumer processing a message is set by the pre-fetch size. It's very important to define the correct pre-fetch size for consumers, since during large volumes of transactions, there is a huge chance of messages piling up, which creates system failovers.

Default values - For Consumer type - queue - 1000 , queue- browser - 500, topic - 32767, durable topic - 1000.

Maven Integration

Mule supports Maven integration. Maven allows you to run performance tests easily using the Maven command line, or run tests automatically as part of your continuous integration.

Maven repo to run:


    <plugin>
    <groupId>org.apache.activemq.tooling</groupId>
    <artifactId>activemq-perf-maven-plugin</artifactId>
    <version>${activemq-version}</version>
    </plugin>

Maven Goals:

  • activemq-perf:consumer - Starts the consumer's performance testing. The generated report file can be found in the directory specified in the parameter "sysTest.reportDir."

  • activemq-perf:producer- Starts the producer's performance testing. The generated report file can be found in the directory specified in the parameter "sysTest.reportDir."

  • activemq-perf:broker - Starts broker using the activemq configuration file located in "src\main\resources\broker-conf" where the default config is activemq.xml.

Parameters: 

  • -DconfigType - specifies the type of configuration to use. Its value must be one of the -DconfigFile - path to config file other than those in "src\..\broker-config".e.g -DconfigFile=c:\dir\activemq.xml).

File-based persistence: Apache ActiveMQ supports a file-based persistence store that can be used to increase throughput for persistent messages. As part of configuration, set pre-acknowledge to true. With pre-acknowledge mode, messages are acknowledged before they are sent to the client; this will reduce the amount of acknowledgment traffic in the flow.  Disable the persistence if you don't need it; you get a good performance boost by disabling persistence.

Integration

Opinions expressed by DZone contributors are their own.

Related

  • Next Evolution in Integration: Architecting With Intent Using Model Context Protocol
  • Integrating Google BigQuery With Amazon SageMaker
  • Optimizing Integration Workflows With Spark Structured Streaming and Cloud Services
  • Docs That Write Themselves: Scaling With gRPC and Protobuf

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: