public class Jms20Support extends Object implements JmsSupport
Jms20Support is a template class to provide an abstraction to to the JMS 2.0 API specification.| Constructor and Description |
|---|
Jms20Support() |
Jms20Support(LookupJndiDestination lookupJndiDestination,
Function<String,Optional<javax.jms.Destination>> jndiObjectSupplier) |
| Modifier and Type | Method and Description |
|---|---|
javax.jms.Connection |
createConnection(javax.jms.ConnectionFactory connectionFactory)
Creates a new
Connection |
javax.jms.Connection |
createConnection(javax.jms.ConnectionFactory connectionFactory,
String username,
String password)
Creates a new
Connection with custom user/password authentication |
javax.jms.MessageConsumer |
createConsumer(javax.jms.Session session,
javax.jms.Destination destination,
String messageSelector,
ConsumerType type)
Creates a new JMS
MessageConsumer using the given Session |
javax.jms.Destination |
createDestination(javax.jms.Session session,
String name,
boolean topic,
JmsConfig config)
Creates a new JMS
Destination with the given name. |
protected Optional<javax.jms.Destination> |
createDestinationFromJndi(String name) |
javax.jms.MessageProducer |
createProducer(javax.jms.Session session,
javax.jms.Destination destination,
boolean topic)
Creates a new JMS
MessageProducer using the given Session |
javax.jms.Session |
createSession(javax.jms.Connection connection,
boolean topic,
boolean transacted,
int ackMode)
Creates a new
Session for the given Connection |
javax.jms.TemporaryQueue |
createTemporaryDestination(javax.jms.Session session)
Creates an anonymous temporary
Queue Destination |
javax.jms.XAConnection |
createXaConnection(javax.jms.XAConnectionFactory connectionFactory)
Creates a new
XAConnection |
javax.jms.XAConnection |
createXaConnection(javax.jms.XAConnectionFactory connectionFactory,
String username,
String password)
Creates a new
XAConnection |
javax.jms.XASession |
createXaSession(javax.jms.XAConnection connection)
Creates a new
Session for the given Connection |
protected Optional<javax.jms.Destination> |
getJndiDestination(String name) |
protected LookupJndiDestination |
getLookupJndiDestination() |
JmsSpecification |
getSpecification() |
void |
send(javax.jms.MessageProducer producer,
javax.jms.Message message,
boolean persistent,
int priority,
long ttl,
boolean topic)
Sends the given
Message to the indicated Destination using the parametrized configurations |
void |
send(javax.jms.MessageProducer producer,
javax.jms.Message message,
boolean persistent,
int priority,
long ttl,
boolean topic,
javax.jms.CompletionListener completionListener)
Sends the given
Message to the indicated Destination using the parametrized configurations in a async way. |
public Jms20Support()
public Jms20Support(LookupJndiDestination lookupJndiDestination, Function<String,Optional<javax.jms.Destination>> jndiObjectSupplier)
public JmsSpecification getSpecification()
getSpecification in interface JmsSupportthis implementation JmsSpecificationpublic javax.jms.Connection createConnection(javax.jms.ConnectionFactory connectionFactory,
String username,
String password)
throws javax.jms.JMSException
Connection with custom user/password authenticationcreateConnection in interface JmsSupportconnectionFactory - the ConnectionFactory to use for creating the Connectionusername - the credentials usernamepassword - the credentials passwordConnectionjavax.jms.JMSException - if an error occurs during connection creationpublic javax.jms.XAConnection createXaConnection(javax.jms.XAConnectionFactory connectionFactory)
throws javax.jms.JMSException
XAConnectioncreateXaConnection in interface JmsSupportconnectionFactory - the XAConnectionFactory to use for creating the XAConnectionConnectionjavax.jms.JMSException - if an error occurs during connection creationpublic javax.jms.XAConnection createXaConnection(javax.jms.XAConnectionFactory connectionFactory,
String username,
String password)
throws javax.jms.JMSException
XAConnectioncreateXaConnection in interface JmsSupportconnectionFactory - the XAConnectionFactory to use for creating the XAConnectionConnectionjavax.jms.JMSException - if an error occurs during connection creationpublic javax.jms.Connection createConnection(javax.jms.ConnectionFactory connectionFactory)
throws javax.jms.JMSException
ConnectioncreateConnection in interface JmsSupportconnectionFactory - the ConnectionFactory to use for creating the ConnectionConnectionjavax.jms.JMSException - if an error occurs during connection creationpublic javax.jms.Session createSession(javax.jms.Connection connection,
boolean topic,
boolean transacted,
int ackMode)
throws javax.jms.JMSException
Session for the given ConnectioncreateSession in interface JmsSupportconnection - the Connection to use for creating the Sessiontopic - if true the Session created will be a TopicSession. This distinction is made only
for JmsSpecification.JMS_1_0_2btransacted - indicates whether the session will use a local transactionackMode - the Session InternalAckModeSessionjavax.jms.JMSException - if an error occurs during connection creationpublic javax.jms.XASession createXaSession(javax.jms.XAConnection connection)
throws javax.jms.JMSException
JmsSupportSession for the given ConnectioncreateXaSession in interface JmsSupportconnection - the XAConnection to use for creating the XASessionXASessionjavax.jms.JMSException - if an error occurs during connection creationpublic javax.jms.MessageProducer createProducer(javax.jms.Session session,
javax.jms.Destination destination,
boolean topic)
throws javax.jms.JMSException
MessageProducer using the given SessioncreateProducer in interface JmsSupportsession - the Session used to create the MessageProducerdestination - the Destination to where the Messages will be publishedtopic - if true the given Destination has a Topic destination type. This distinction is
made only for JmsSpecification.JMS_1_0_2b in order to decide whether to create a
TopicPublisher or a QueueSenderMessageProducer for the given Destinationjavax.jms.JMSException - if an error occurs while creating the consumerpublic javax.jms.MessageConsumer createConsumer(javax.jms.Session session,
javax.jms.Destination destination,
String messageSelector,
ConsumerType type)
throws javax.jms.JMSException
MessageConsumer using the given SessioncreateConsumer in interface JmsSupportsession - the Session used to create the MessageConsumerdestination - the Destination from which Messages will be consumedmessageSelector - a JMS selector string for filtering incoming Messages. Empty or null implies no
filteringtype - the ConsumerType to use based on the Destination typeMessageConsumer for the given Destinationjavax.jms.JMSException - if an error occurs while creating the consumerpublic javax.jms.Destination createDestination(javax.jms.Session session,
String name,
boolean topic,
JmsConfig config)
throws javax.jms.JMSException,
DestinationNotFoundException
Destination with the given name. If LookupJndiDestination.ALWAYS or
LookupJndiDestination.TRY_ALWAYS where configured, this name will be used for performing the JNDI lookupcreateDestination in interface JmsSupportsession - the Session used to create the Destinationname - the name of the destinationtopic - if true, a Topic Destination will be created, otherwise the Queue default is
usedDestinationjavax.jms.JMSException - if an error occurs during the creation of the destinationDestinationNotFoundException - if LookupJndiDestination.ALWAYS is configured and no Destination with
the given name is foundprotected Optional<javax.jms.Destination> createDestinationFromJndi(String name) throws javax.jms.JMSException
javax.jms.JMSExceptionpublic javax.jms.TemporaryQueue createTemporaryDestination(javax.jms.Session session)
throws javax.jms.JMSException
Queue DestinationcreateTemporaryDestination in interface JmsSupportsession - the Session used to create the DestinationQueue Destinationjavax.jms.JMSException - if an error occurs during destination creationpublic void send(javax.jms.MessageProducer producer,
javax.jms.Message message,
boolean persistent,
int priority,
long ttl,
boolean topic)
throws javax.jms.JMSException
Message to the indicated Destination using the parametrized configurationssend in interface JmsSupportproducer - the MessageProducer to use for sending the messagemessage - the Message to sendpersistent - true if DeliveryMode.PERSISTENT should be usedpriority - the Message.getJMSPriority() to be set on sendttl - the message's lifetime (in milliseconds)topic - used by JmsSpecification.JMS_1_0_2b to decide whether to use the MessageProducer as
TopicPublisher or a QueueSenderjavax.jms.JMSException - if an error occurs during messsage sendingpublic void send(javax.jms.MessageProducer producer,
javax.jms.Message message,
boolean persistent,
int priority,
long ttl,
boolean topic,
javax.jms.CompletionListener completionListener)
throws javax.jms.JMSException
Message to the indicated Destination using the parametrized configurations in a async way.send in interface JmsSupportproducer - the MessageProducer to use for sending the messagemessage - the Message to sendpersistent - true if DeliveryMode.PERSISTENT should be usedpriority - the Message.getJMSPriority() to be set on sendttl - the message's lifetime (in milliseconds)topic - used by JmsSpecification.JMS_1_0_2b to decide whether to use the MessageProducer as
TopicPublisher or a QueueSenderjavax.jms.JMSException - if an error occurs during messsage sendingprotected LookupJndiDestination getLookupJndiDestination()
Copyright © 2023. All rights reserved.