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
|
javax.jms.BytesMessage |
createBytesMessage() |
ActiveMQConnectionFactory |
createConnectionFactory()
Create an ActiveMQConnectionFactory for the embedded ActiveMQ Broker
|
javax.jms.MapMessage |
createMapMessage() |
javax.jms.BytesMessage |
createMessage(byte[] body) |
javax.jms.BytesMessage |
createMessage(byte[] body,
Map<String,Object> properties) |
javax.jms.MapMessage |
createMessage(Map<String,Object> body) |
javax.jms.MapMessage |
createMessage(Map<String,Object> body,
Map<String,Object> properties) |
javax.jms.ObjectMessage |
createMessage(Serializable body) |
javax.jms.ObjectMessage |
createMessage(Serializable body,
Map<String,Object> properties) |
javax.jms.TextMessage |
createMessage(String body) |
javax.jms.TextMessage |
createMessage(String body,
Map<String,Object> properties) |
javax.jms.ObjectMessage |
createObjectMessage() |
PooledConnectionFactory |
createPooledConnectionFactory()
Create an PooledConnectionFactory for the embedded ActiveMQ Broker
|
javax.jms.StreamMessage |
createStreamMessage() |
javax.jms.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() |
javax.jms.BytesMessage |
peekBytesMessage(String destinationName) |
javax.jms.MapMessage |
peekMapMessage(String destinationName) |
javax.jms.Message |
peekMessage(String destinationName) |
javax.jms.ObjectMessage |
peekObjectMessage(String destinationName) |
javax.jms.StreamMessage |
peekStreamMessage(String destinationName) |
javax.jms.TextMessage |
peekTextMessage(String destinationName) |
javax.jms.BytesMessage |
pushMessage(String destinationName,
byte[] body) |
javax.jms.MapMessage |
pushMessage(String destinationName,
Map<String,Object> body) |
void |
pushMessage(String destinationName,
javax.jms.Message message) |
javax.jms.ObjectMessage |
pushMessage(String destinationName,
Serializable body) |
javax.jms.TextMessage |
pushMessage(String destinationName,
String body) |
javax.jms.BytesMessage |
pushMessageWithProperties(String destinationName,
byte[] body,
Map<String,Object> properties) |
javax.jms.MapMessage |
pushMessageWithProperties(String destinationName,
Map<String,Object> body,
Map<String,Object> properties) |
javax.jms.ObjectMessage |
pushMessageWithProperties(String destinationName,
Serializable body,
Map<String,Object> properties) |
javax.jms.TextMessage |
pushMessageWithProperties(String destinationName,
String body,
Map<String,Object> properties) |
void |
setBrokerName(String brokerName) |
static void |
setMessageProperties(javax.jms.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.
|
apply
public 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(javax.jms.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.ExternalResource
Throwable
protected void after()
after
in class org.junit.rules.ExternalResource
public 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 javax.jms.BytesMessage createBytesMessage()
public javax.jms.TextMessage createTextMessage()
public javax.jms.MapMessage createMapMessage()
public javax.jms.ObjectMessage createObjectMessage()
public javax.jms.StreamMessage createStreamMessage()
public javax.jms.BytesMessage createMessage(byte[] body)
public javax.jms.TextMessage createMessage(String body)
public javax.jms.MapMessage createMessage(Map<String,Object> body)
public javax.jms.ObjectMessage createMessage(Serializable body)
public javax.jms.BytesMessage createMessage(byte[] body, Map<String,Object> properties)
public javax.jms.TextMessage createMessage(String body, Map<String,Object> properties)
public javax.jms.MapMessage createMessage(Map<String,Object> body, Map<String,Object> properties)
public javax.jms.ObjectMessage createMessage(Serializable body, Map<String,Object> properties)
public void pushMessage(String destinationName, javax.jms.Message message)
public javax.jms.BytesMessage pushMessage(String destinationName, byte[] body)
public javax.jms.TextMessage pushMessage(String destinationName, String body)
public javax.jms.MapMessage pushMessage(String destinationName, Map<String,Object> body)
public javax.jms.ObjectMessage pushMessage(String destinationName, Serializable body)
public javax.jms.BytesMessage pushMessageWithProperties(String destinationName, byte[] body, Map<String,Object> properties)
public javax.jms.TextMessage pushMessageWithProperties(String destinationName, String body, Map<String,Object> properties)
public javax.jms.MapMessage pushMessageWithProperties(String destinationName, Map<String,Object> body, Map<String,Object> properties)
public javax.jms.ObjectMessage pushMessageWithProperties(String destinationName, Serializable body, Map<String,Object> properties)
public javax.jms.Message peekMessage(String destinationName)
public javax.jms.BytesMessage peekBytesMessage(String destinationName)
public javax.jms.TextMessage peekTextMessage(String destinationName)
public javax.jms.MapMessage peekMapMessage(String destinationName)
public javax.jms.ObjectMessage peekObjectMessage(String destinationName)
public javax.jms.StreamMessage peekStreamMessage(String destinationName)
Copyright © 2005–2019 The Apache Software Foundation. All rights reserved.