public class EmbeddedActiveMQBroker extends org.junit.rules.ExternalResource
| Modifier and Type | Class and Description |
|---|---|
static class |
EmbeddedActiveMQBroker.EmbeddedActiveMQBrokerException |
| Constructor and Description |
|---|
EmbeddedActiveMQBroker()
Create an embedded ActiveMQ broker using defaults
|
EmbeddedActiveMQBroker(String configurationURI)
Create an embedded ActiveMQ broker using a configuration URI
|
EmbeddedActiveMQBroker(URI configurationURI)
Create an embedded ActiveMQ broker using a configuration URI
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
after()
Stop the embedded ActiveMQ Broker
Invoked by JUnit to tear down the resource
|
protected void |
before()
Start the embedded ActiveMQ Broker
Invoked by JUnit to setup the resource
|
protected void |
configure()
Customize the configuration of the embedded ActiveMQ broker
|
BytesMessage |
createBytesMessage() |
org.apache.activemq.ActiveMQConnectionFactory |
createConnectionFactory()
Create an ActiveMQConnectionFactory for the embedded ActiveMQ Broker
|
MapMessage |
createMapMessage() |
BytesMessage |
createMessage(byte[] body) |
BytesMessage |
createMessage(byte[] body,
Map<String,Object> properties) |
MapMessage |
createMessage(Map<String,Object> body) |
MapMessage |
createMessage(Map<String,Object> body,
Map<String,Object> properties) |
ObjectMessage |
createMessage(Serializable body) |
ObjectMessage |
createMessage(Serializable body,
Map<String,Object> properties) |
TextMessage |
createMessage(String body) |
TextMessage |
createMessage(String body,
Map<String,Object> properties) |
ObjectMessage |
createObjectMessage() |
PooledConnectionFactory |
createPooledConnectionFactory()
Create an PooledConnectionFactory for the embedded ActiveMQ Broker
|
StreamMessage |
createStreamMessage() |
TextMessage |
createTextMessage() |
void |
disableAdvisoryForConsumed() |
void |
disableAdvisoryForDelivery() |
void |
disableAdvisoryForDiscardingMessages() |
void |
disableAdvisoryForFastProducers() |
void |
disableAdvisoryForSlowConsumers() |
void |
disableStatisticsPlugin() |
void |
enableAdvisoryForConsumed() |
void |
enableAdvisoryForDelivery() |
void |
enableAdvisoryForDiscardingMessages() |
void |
enableAdvisoryForFastProducers() |
void |
enableAdvisoryForSlowConsumers() |
void |
enableStatisticsPlugin() |
String |
getBrokerName()
Get the name of the embedded ActiveMQ Broker
|
BrokerService |
getBrokerService()
Get the BrokerService for the embedded ActiveMQ broker.
|
Destination |
getDestination(String destinationName)
Get the ActiveMQ destination
The full name of the JMS destination including the prefix should be provided - i.e.
|
long |
getMessageCount(String destinationName)
Get the number of messages in a specific JMS Destination.
|
URI |
getVmURI()
Get the failover VM URI for the embedded ActiveMQ Broker
NOTE: The create=false option is appended to the URI to avoid the automatic creation of brokers
and the resulting duplicate broker errors
|
URI |
getVmURI(boolean failoverURI)
Get the VM URI for the embedded ActiveMQ Broker
NOTE: The create=false option is appended to the URI to avoid the automatic creation of brokers
and the resulting duplicate broker errors
|
String |
getVmURL()
Get the failover VM URL for the embedded ActiveMQ Broker
NOTE: The create=false option is appended to the URL to avoid the automatic creation of brokers
and the resulting duplicate broker errors
|
String |
getVmURL(boolean failoverURL)
Get the VM URL for the embedded ActiveMQ Broker
NOTE: The create=false option is appended to the URL to avoid the automatic creation of brokers
and the resulting duplicate broker errors
|
boolean |
isAdvisoryForConsumedEnabled() |
boolean |
isAdvisoryForDeliveryEnabled() |
boolean |
isAdvisoryForDiscardingMessagesEnabled() |
boolean |
isAdvisoryForFastProducersEnabled() |
boolean |
isAdvisoryForSlowConsumersEnabled() |
boolean |
isStatisticsPluginEnabled() |
BytesMessage |
peekBytesMessage(String destinationName) |
MapMessage |
peekMapMessage(String destinationName) |
Message |
peekMessage(String destinationName) |
ObjectMessage |
peekObjectMessage(String destinationName) |
StreamMessage |
peekStreamMessage(String destinationName) |
TextMessage |
peekTextMessage(String destinationName) |
BytesMessage |
pushMessage(String destinationName,
byte[] body) |
MapMessage |
pushMessage(String destinationName,
Map<String,Object> body) |
void |
pushMessage(String destinationName,
Message message) |
ObjectMessage |
pushMessage(String destinationName,
Serializable body) |
TextMessage |
pushMessage(String destinationName,
String body) |
BytesMessage |
pushMessageWithProperties(String destinationName,
byte[] body,
Map<String,Object> properties) |
MapMessage |
pushMessageWithProperties(String destinationName,
Map<String,Object> body,
Map<String,Object> properties) |
ObjectMessage |
pushMessageWithProperties(String destinationName,
Serializable body,
Map<String,Object> properties) |
TextMessage |
pushMessageWithProperties(String destinationName,
String body,
Map<String,Object> properties) |
void |
setBrokerName(String brokerName) |
static void |
setMessageProperties(Message message,
Map<String,Object> properties) |
void |
start()
Start the embedded ActiveMQ broker, blocking until the broker has successfully started.
|
void |
stop()
Stop the embedded ActiveMQ broker, blocking until the broker has stopped.
|
applypublic EmbeddedActiveMQBroker()
The defaults are: - the broker name is 'embedded-broker' - JMX is enable but no management connector is created. - Persistence is disabled
public EmbeddedActiveMQBroker(String configurationURI)
public EmbeddedActiveMQBroker(URI configurationURI)
public static void setMessageProperties(Message message, Map<String,Object> properties)
protected void configure()
This method is called before the embedded ActiveMQ broker is started, and can be overridden to this method to customize the broker configuration.
public void start()
public void stop()
protected void before() throws Throwable
before in class org.junit.rules.ExternalResourceThrowableprotected void after()
after in class org.junit.rules.ExternalResourcepublic org.apache.activemq.ActiveMQConnectionFactory createConnectionFactory()
public PooledConnectionFactory createPooledConnectionFactory()
public BrokerService getBrokerService()
public String getVmURL()
public String getVmURL(boolean failoverURL)
failoverURL - if true a failover URL will be returnedpublic URI getVmURI()
public URI getVmURI(boolean failoverURI)
failoverURI - if true a failover URI will be returnedpublic String getBrokerName()
public void setBrokerName(String brokerName)
public boolean isStatisticsPluginEnabled()
public void enableStatisticsPlugin()
public void disableStatisticsPlugin()
public boolean isAdvisoryForDeliveryEnabled()
public void enableAdvisoryForDelivery()
public void disableAdvisoryForDelivery()
public boolean isAdvisoryForConsumedEnabled()
public void enableAdvisoryForConsumed()
public void disableAdvisoryForConsumed()
public boolean isAdvisoryForDiscardingMessagesEnabled()
public void enableAdvisoryForDiscardingMessages()
public void disableAdvisoryForDiscardingMessages()
public boolean isAdvisoryForFastProducersEnabled()
public void enableAdvisoryForFastProducers()
public void disableAdvisoryForFastProducers()
public boolean isAdvisoryForSlowConsumersEnabled()
public void enableAdvisoryForSlowConsumers()
public void disableAdvisoryForSlowConsumers()
public long getMessageCount(String destinationName)
destinationName - the full name of the JMS Destinationpublic Destination getDestination(String destinationName)
destinationName - the full name of the JMS Destinationpublic BytesMessage createBytesMessage()
public TextMessage createTextMessage()
public MapMessage createMapMessage()
public ObjectMessage createObjectMessage()
public StreamMessage createStreamMessage()
public BytesMessage createMessage(byte[] body)
public TextMessage createMessage(String body)
public MapMessage createMessage(Map<String,Object> body)
public ObjectMessage createMessage(Serializable body)
public BytesMessage createMessage(byte[] body, Map<String,Object> properties)
public TextMessage createMessage(String body, Map<String,Object> properties)
public MapMessage createMessage(Map<String,Object> body, Map<String,Object> properties)
public ObjectMessage createMessage(Serializable body, Map<String,Object> properties)
public void pushMessage(String destinationName, Message message)
public BytesMessage pushMessage(String destinationName, byte[] body)
public TextMessage pushMessage(String destinationName, String body)
public MapMessage pushMessage(String destinationName, Map<String,Object> body)
public ObjectMessage pushMessage(String destinationName, Serializable body)
public BytesMessage pushMessageWithProperties(String destinationName, byte[] body, Map<String,Object> properties)
public TextMessage pushMessageWithProperties(String destinationName, String body, Map<String,Object> properties)
public MapMessage pushMessageWithProperties(String destinationName, Map<String,Object> body, Map<String,Object> properties)
public ObjectMessage pushMessageWithProperties(String destinationName, Serializable body, Map<String,Object> properties)
public Message peekMessage(String destinationName)
public BytesMessage peekBytesMessage(String destinationName)
public TextMessage peekTextMessage(String destinationName)
public MapMessage peekMapMessage(String destinationName)
public ObjectMessage peekObjectMessage(String destinationName)
public StreamMessage peekStreamMessage(String destinationName)
Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.