Top ActiveMQ Interview Questions(2021) | CodeUsingJava
















Top ActiveMQ Interview Questions(2021)

In this post we will look at Apache ActiveMQ Interview questions. Examples are provided with explanation.
Apache ActiveMQ Interview Questions
  1. What is Activemq?
  2. Features of Apache ActiveMQ?
  3. How Does Activemq Compare To Fuse Message Broker?
  4. What is JMS?
  5. Difference between ActiveMQ or RabbitMQ?
  6. What are clusters in Apache ActiveMQ?
  7. What is KahaDB?
  8. How Does Activemq Compare To Amqp?
  9. How can we publish a JMS topic with Spring JMS?
  10. How to integrate ActiveMQ with Apache Camel?
  11. What is topic in ActiveMQ?
  12. How does Activemq compare to Artemis?
  13. How to set the ActiveMQ redeliveryPolicy on a queue?
  14. How does Activemq compare to Fuse Message Broker?
  15. How do we configure multiple JmsListener for multiple topics?
  16. How can we enable instances for Apache ActiveMQ running on Ubuntu?
  17. Which open wire protocols ActiveMQ supports?
  18. How can we change default port number of Activemq?
  19. How to install ActiveMQ as a 64-bit Service on windows?
  20. How can we JMX for ActiveMQ for remoting access?

What is Activemq?

Apache ActiveMQ is message-oriented middleware (MOM), a category of software that sends messages between applications. Using standards-based, asynchronous communication, ActiveMQ allows loose coupling of the elements in an IT environment, which is often foundational to enterprise messaging and distributed applications. ActiveMQ translates messages from sender to receiver. It can connect multiple clients and servers and allows messages to be held in queue, instead of requiring both the client and server to be available simultaneously in order to communicate. Activemq interview questions

Features of Apache ActiveMQ?

  • Supports a variety of Cross Language Clients and Protocols from Java, C, C++, C#, Ruby, Perl, Python, PHP.
  • Supports many advanced features such as Message Groups, Virtual Destinations, Wildcards and Composite Destinations.
  • Can be used as an in memory JMS provider, ideal for unit testing JMS.
  • Supports pluggable transport protocols such as in-VM, TCP, SSL, NIO, UDP, multicast, JGroups and JXTA transports.
  • Supports very fast persistence using JDBC along with a high performance journal.

How Does Activemq Compare To Fuse Message Broker?

Fuse Message Broker is a certified distribution of Apache ActiveMQ provided by FuseSource. FuseSource does all of its development and bug fixes as part of the Apache ActiveMQ community, so there are no functional differences between the two. FuseSource may do more frequent releases than Apache, so it is possible to get bug fixes from a Fuse Message Broker release sooner than from an official Apache ActiveMQ release. with other checks like automated code quality tests, syntax style review tools, and more.

What is JMS?

JMS (Java Message Service) is an API that provides the facility to create, send and read messages. It provides loosely coupled, reliable and asynchronous communication. JMS is also known as a messaging service.

Difference between ActiveMQ or RabbitMQ?

  • ActiveMQ is an open-source message broker is scripted in Java which is based on Java Message Service client.
  • RabbitMQ is implemented on Advanced Message Queueing protocol.

What are clusters in Apache ActiveMQ?

  • ActiveMQ supports reliable high performance load balancing of messages on a queue across consumers. In enterprise integration, this scenario is known as the competing consumers pattern. The following figure illustrates the concept: Activemq interview questions
  • The load is distributed in a very dynamic fashion. Additional consumers could be provisioned and attached to the queue in high load periods, without modifying any configuration in the queue, as the new consumer would behave as just another competing consumer. Better availability than systems using a load balancer. Load balancers usually rely on a monitorization system to find out which real-servers are unavailable. With competing consumers, a failed consumer will not be competing for messages and therefore messages not be delivered to it even without monitorization.

What is KahaDB?

KahaDB is a file based persistence database that is local to the message broker that is using it. It has been optimized for fast persistence. It is the the default storage mechanism since ActiveMQ 5.4. KahaDB uses less file descriptors and provides faster recovery than its predecessor, the AMQ Message Store.

How Does Activemq Compare To Amqp?

Advanced Message Queue Protocol acts as a specification for how the messaging client and brokers will interoperate, it is also a wire level protocol for client to message broker communication.
AMQP is not a messaging system such as ActiveMQ, it can be a message protocol.
AMQP supports open wire protocols such as:
OpenWire, a fast binary format.
Stomp, a simple and easily implemented text based-protocol.
MQTT, a compact binary format for limited devices on an unreliable network.

How can we publish a JMS topic with Spring JMS?

We can publish JMS Topic by using the following command:
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
   <constructor-arg ref="connectionFactory" />
   <property name="pubSubDomain" value="false"/>
</bean>


How to integrate ActiveMQ with Apache Camel?

We need to configure it by adding the following jars in your project.

<bean id = "jms" class = "org.apache.camel.component.jms.JmsComponent">
<property name = "connectionFactory">
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name = "orderQueue" value = "tcp://localhost:61000" />
</bean>
</property>
</bean>



What is topic in ActiveMQ?

Virtual Topics are the combination of Topics and Queues, the messages to the topic are the listeners that will consume messages from the queues.
ActiveMQ helps in copying and duplicating every message to the actual consumers queues from the topic.

ActiveMQ

How does Activemq compare to Artemis?

Artemis is used as a code name for the HornetQ code which was donated to the Apache Foundation.Artemis can be the successor for ActiveMQ 5.x, it is documented as that month's ActiveMQ Board Report.

How to set the ActiveMQ redeliveryPolicy on a queue?


<amq:connectionFactory id="amqConnectionFactory" brokerURL="" >
    <amq:properties>
        <amq:redeliveryPolicy maximumRedeliveries="6" initialRedeliveryDelay="15000" useExponentialBackOff="true" backOffMultiplier="5"/>
    </amq:properties>
</amq:connectionFactory>



How does Activemq compare to Fuse Message Broker?

Multiple Protocol Messaging is is Java based message broker, that supports industry standard protocols as the users will get the befits of client chcoices across btoad range of languages such as JavaScript, C, C++, Python.
Fuse Message Broker acts as a distributer of Apache ActiveMQ whic is provided by FuseSource, it develops and bugs fixes as a part of thr Apache ActiveMQ community.It is possible to get bugged fixes from the Fuse Broker release sonner than an Official Apache ActiveMQ release.

How do we configure multiple JmsListener for multiple topics?

@JmsListener(destination = "foo1")
public void foo1(final Message jsonMessage) throws JMSException {
    ...
}

@JmsListener(destination = "foo2")
public void foo12(final Message jsonMessage) throws JMSException {
    ...
}


How can we enable instances for Apache ActiveMQ running on Ubuntu?

We can configure activemq/instances-available/main by using:

sudo ln -s /etc/activemq/instances-available/main /etc/activemq/instances-enabled/main



Which open wire protocols ActiveMQ supports?

OpenWire
Stomp
MQTT
They are the Open Wire Protocols supported by ActiveMQ.

How can we change default port number of Activemq?

We can use the code for changing the default port number of ActiveMQ.

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:
 28+0530)
 Maven home: P:\Software\apache-maven-3.0.5
 Java version: 1.7.0_21, vendor: Oracle Corporation
 Java home: C:\Program Files\Java\jdk1.7.0_21\jre
 Default locale: en_US, platform encoding: Cp1252
 OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
 


How to install ActiveMQ as a 64-bit Service on windows?


:conf
set _WRAPPER_CONF="%ACTIVEMQ_HOME%\bin\win32\wrapper.conf"

set _ACTIVEMQ_HOME="set.ACTIVEMQ_HOME=%ACTIVEMQ_HOME%"
set _ACTIVEMQ_BASE="set.ACTIVEMQ_BASE=%ACTIVEMQ_BASE%"
set _JAVA_HOME="set.JAVA_HOME=%JAVA_HOME%"

rem
rem Install the Wrapper as an NT service.
rem
:startup
"%ACTIVEMQ_HOME%\bin\win32\wrapper.exe" -i %_WRAPPER_CONF% %_ACTIVEMQ_HOME% %_ACTIVEMQ_BASE% %_JAVA_HOME%
if not errorlevel 1 goto :eof
pause



How can we JMX for ActiveMQ for remoting access?

<broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" useJmx="true">

<managementContext>
  <managementContext createConnector="true" connectorPort="1099"/>
</managementContext>