public class EmbeddedJMSResource
extends org.junit.rules.ExternalResource
public class SimpleTest {| Modifier and Type | Class and Description |
|---|---|
static class |
EmbeddedJMSResource.EmbeddedJMSResourceException |
| Constructor and Description |
|---|
EmbeddedJMSResource()
Create a default EmbeddedJMSResource
|
EmbeddedJMSResource(boolean useNetty)
Create a default EmbeddedJMSResource
|
EmbeddedJMSResource(org.apache.activemq.artemis.core.config.Configuration configuration,
JMSConfiguration jmsConfiguration)
Create an EmbeddedJMSResource with the specified configurations
|
EmbeddedJMSResource(int serverId)
Create a default EmbeddedJMSResource with the specified server id
|
EmbeddedJMSResource(String filename)
Create an EmbeddedJMSResource with the specified configuration file
|
EmbeddedJMSResource(String serverConfigurationFileName,
String jmsConfigurationFileName)
Create an EmbeddedJMSResource with the specified configuration file
|
| Modifier and Type | Method and Description |
|---|---|
EmbeddedJMSResource |
addAcceptor(String name,
String uri)
The acceptor used
|
protected void |
after()
Stop the embedded ActiveMQ Broker
|
protected void |
before()
Start the embedded ActiveMQ Broker
|
javax.jms.BytesMessage |
createBytesMessage() |
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() |
javax.jms.StreamMessage |
createStreamMessage() |
javax.jms.TextMessage |
createTextMessage() |
org.apache.activemq.artemis.core.server.Queue |
getDestinationQueue(String destinationName)
Get the Queue corresponding to a JMS Destination.
|
EmbeddedJMS |
getJmsServer()
Get the EmbeddedJMS server.
|
long |
getMessageCount(String destinationName)
Get the number of messages in a specific JMS Destination.
|
String |
getServerName()
Get the name of the EmbeddedJMS server
|
List<org.apache.activemq.artemis.core.server.Queue> |
getTopicQueues(String topicName)
Get the Queues corresponding to a JMS Topic.
|
String |
getVmURL()
Get the VM URL for the embedded EmbeddedActiveMQ server
|
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) |
static void |
setMessageProperties(javax.jms.Message message,
Map<String,Object> properties) |
void |
start()
Start the embedded EmbeddedJMSResource.
|
void |
stop()
Stop the embedded ActiveMQ broker, blocking until the broker has stopped.
|
public EmbeddedJMSResource()
public EmbeddedJMSResource(boolean useNetty)
public EmbeddedJMSResource(int serverId)
public EmbeddedJMSResource(org.apache.activemq.artemis.core.config.Configuration configuration,
JMSConfiguration jmsConfiguration)
configuration - ActiveMQServer configurationjmsConfiguration - JMSServerManager configurationpublic EmbeddedJMSResource(String filename)
filename - configuration file namepublic EmbeddedJMSResource(String serverConfigurationFileName, String jmsConfigurationFileName)
serverConfigurationFileName - ActiveMQServer configuration file namejmsConfigurationFileName - JMSServerManager configuration file namepublic EmbeddedJMSResource addAcceptor(String name, String uri) throws Exception
Exceptionpublic static void setMessageProperties(javax.jms.Message message,
Map<String,Object> properties)
public void start()
The server will normally be started by JUnit using the before() method. This method allows the server to be started manually to support advanced testing scenarios.
public void stop()
The broker will normally be stopped by JUnit using the after() method. This method allows the broker to be stopped manually to support advanced testing scenarios.
protected void before()
throws Throwable
Invoked by JUnit to setup the resource
before in class org.junit.rules.ExternalResourceThrowableprotected void after()
Invoked by JUnit to tear down the resource
after in class org.junit.rules.ExternalResourcepublic EmbeddedJMS getJmsServer()
This may be required for advanced configuration of the EmbeddedJMS server.
public String getServerName()
public String getVmURL()
public org.apache.activemq.artemis.core.server.Queue getDestinationQueue(String destinationName)
The full name of the JMS destination including the prefix should be provided - i.e. queue://myQueue or topic://myTopic. If the destination type prefix is not included in the destination name, a prefix of "queue://" is assumed.
destinationName - the full name of the JMS Destinationpublic List<org.apache.activemq.artemis.core.server.Queue> getTopicQueues(String topicName)
The full name of the JMS Topic including the prefix should be provided - i.e. topic://myTopic. If the destination type prefix is not included in the destination name, a prefix of "topic://" is assumed.
topicName - the full name of the JMS Destinationpublic long getMessageCount(String destinationName)
The full name of the JMS destination including the prefix should be provided - i.e. queue://myQueue or topic://myTopic. If the destination type prefix is not included in the destination name, a prefix of "queue://" is assumed. NOTE: For JMS Topics, this returned count will be the total number of messages for all subscribers. For example, if there are two subscribers on the topic and a single message is published, the returned count will be two (one message for each subscriber).
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.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.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 © 2023 The Apache Software Foundation. All Rights Reserved.