public interface JmsAPI
支持日志和审计的操作包括:send、receive
Provides send(..)
and receive(..)
methods that mirror various JMS API methods. See the JMS specification and javadocs for details on those methods.
Provides also basic request reply operation using a temporary queue to collect the reply.
javax.jms.Destination
,
javax.jms.Session
,
javax.jms.MessageProducer
,
javax.jms.MessageConsumer
限定符和类型 | 字段和说明 |
---|---|
static long |
RECEIVE_TIMEOUT_INDEFINITE_WAIT
Timeout value indicating a blocking receive without timeout.
|
static long |
RECEIVE_TIMEOUT_NO_WAIT
Timeout value indicating that a receive operation should check if a message is immediately available without blocking.
|
限定符和类型 | 方法和说明 |
---|---|
<T> T |
browse(<any> action)
Browse messages in the default JMS queue.
|
<T> T |
browse(java.lang.String queueName,
<any> action)
Browse messages in a JMS queue.
|
<T> T |
browseSelected(java.lang.String messageSelector,
<any> action)
Browse selected messages in a JMS queue.
|
<T> T |
browseSelected(java.lang.String queueName,
java.lang.String messageSelector,
<any> action)
Browse selected messages in a JMS queue.
|
void |
close() |
<T> T |
execute(<any> action)
Execute the action specified by the given action object within a JMS Session.
|
<T> T |
execute(<any> action)
Send messages to the default JMS destination (or one specified for each send operation).
|
<T> T |
execute(java.lang.String destinationName,
<any> action)
Send messages to a JMS destination.
|
Message |
receive()
Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.
|
Message |
receive(java.lang.String destinationName)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.
|
Message |
receiveSelected(java.lang.String messageSelector)
Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.
|
Message |
receiveSelected(java.lang.String destinationName,
java.lang.String messageSelector)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.
|
JmsAPI |
sDefaultDestination(java.lang.Object destination)
设置消息默认目的地
|
JmsAPI |
sDeliveryMode(int deliveryMode)
设置发送模式
|
JmsAPI |
sDestinationResolver(DestinationResolver destinationResolver) |
void |
send(MessageCreator messageCreator)
Send a message to the default destination.
|
void |
send(java.lang.String destinationName,
MessageCreator messageCreator)
Send a message to the specified destination.
|
Message |
sendAndReceive(MessageCreator messageCreator)
Send a request message and receive the reply from a default destination.
|
Message |
sendAndReceive(java.lang.String destinationName,
MessageCreator messageCreator)
Send a message and receive the reply from the specified destination.
|
JmsAPI |
sExplicitQosEnabled(boolean explicitQosEnabled) |
JmsAPI |
sMessageIdEnabled(boolean messageIdEnabled)
Set whether message IDs are enabled.
|
JmsAPI |
sMessageTimestampEnabled(boolean messageTimestampEnabled)
Set whether message timestamps are enabled.
|
JmsAPI |
sPriority(int priority)
设置消息优先级
|
JmsAPI |
sReceiveTimeout(long receiveTimeout)
Set the timeout to use for receive calls (in milliseconds).
|
JmsAPI |
sSessionAcknowledgeMode(int sessionAcknowledgeMode)
设置确认模式
|
JmsAPI |
sSessionTransacted(boolean sessionTransacted)
Set the transaction mode that is used when creating a JMS
Session . |
JmsAPI |
sTimeToLive(long timeToLive)
Set the time-to-live of the message when sending.
|
JmsAPI |
sTopic(boolean pubSubDomain)
设置是否topic
|
static final long RECEIVE_TIMEOUT_NO_WAIT
static final long RECEIVE_TIMEOUT_INDEFINITE_WAIT
void close()
JmsAPI sDefaultDestination(java.lang.Object destination)
destination
- JmsAPI sDeliveryMode(int deliveryMode)
deliveryMode
- JmsAPI sMessageIdEnabled(boolean messageIdEnabled)
This is only a hint to the JMS producer. See the JMS javadocs for details.
messageIdEnabled
- JmsAPI sMessageTimestampEnabled(boolean messageTimestampEnabled)
This is only a hint to the JMS producer. See the JMS javadocs for details.
messageTimestampEnabled
- JmsAPI sReceiveTimeout(long receiveTimeout)
The default is RECEIVE_TIMEOUT_INDEFINITE_WAIT
, which indicates a blocking receive without timeout.
Specify RECEIVE_TIMEOUT_NO_WAIT
(or any other negative value) to indicate that a receive operation should check if a message is immediately available without blocking.
receiveTimeout
- JmsAPI sTimeToLive(long timeToLive)
Since a default value may be defined administratively, this is only used when "isExplicitQosEnabled" equals "true".
timeToLive
- JmsAPI sPriority(int priority)
priority
- JmsAPI sExplicitQosEnabled(boolean explicitQosEnabled)
JmsAPI sSessionTransacted(boolean sessionTransacted)
Session
. Default is "false". Note that within a JTA transaction, the parameters passed to create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)
method are not taken into account. Depending on the Java EE transaction context, the container makes its own decisions on these values. Analogously, these parameters are not taken into account within a locally managed transaction either, since the accessor operates on an existing JMS Session in this case.
Setting this flag to "true" will use a short local JMS transaction when running outside of a managed transaction, and a synchronized local JMS transaction in case of a managed transaction (other than an XA transaction) being present. This has the effect of a local JMS transaction being managed alongside the main transaction (which might be a native JDBC transaction), with the JMS transaction committing right after the main transaction.
sessionTransacted
- JmsAPI sSessionAcknowledgeMode(int sessionAcknowledgeMode)
sessionAcknowledgeMode
- JmsAPI sTopic(boolean pubSubDomain)
pubSubDomain
- JmsAPI sDestinationResolver(DestinationResolver destinationResolver)
<T> T execute(<any> action) throws JmsException
action
- callback object that exposes the sessionJmsException
- if there is any problem<T> T execute(<any> action) throws JmsException
action
- callback object that exposes the session/producer pairJmsException
- checked JMSException converted to unchecked<T> T execute(java.lang.String destinationName, <any> action) throws JmsException
destinationName
- the name of the destination to send messages to (to be resolved to an actual destination by a DestinationResolver)action
- callback object that exposes the session/producer pairJmsException
- checked JMSException converted to uncheckedvoid send(MessageCreator messageCreator) throws JmsException
This will only work with a default destination specified!
messageCreator
- callback to create a messageJmsException
- checked JMSException converted to uncheckedvoid send(java.lang.String destinationName, MessageCreator messageCreator) throws JmsException
destinationName
- the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)messageCreator
- callback to create a messageJmsException
- checked JMSException converted to uncheckedMessage receive() throws JmsException
This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
This will only work with a default destination specified!
null
if the timeout expiresJmsException
- checked JMSException converted to uncheckedMessage receive(java.lang.String destinationName) throws JmsException
This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
destinationName
- the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)null
if the timeout expiresJmsException
- checked JMSException converted to uncheckedMessage receiveSelected(java.lang.String messageSelector) throws JmsException
This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
This will only work with a default destination specified!
messageSelector
- the JMS message selector expression (or null
if none). See the JMS specification for a detailed definition of selector expressions.null
if the timeout expiresJmsException
- checked JMSException converted to uncheckedMessage receiveSelected(java.lang.String destinationName, java.lang.String messageSelector) throws JmsException
This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
destinationName
- the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)messageSelector
- the JMS message selector expression (or null
if none). See the JMS specification for a detailed definition of selector expressions.null
if the timeout expiresJmsException
- checked JMSException converted to uncheckedMessage sendAndReceive(MessageCreator messageCreator) throws JmsException
MessageCreator
callback creates the message given a Session. A temporary queue is created as part of this operation and is set in the JMSReplyTO
header of the message. This will only work with a default destination specified!
messageCreator
- callback to create a request messagenull
if the message could not be received, for example due to a timeoutJmsException
- checked JMSException converted to uncheckedMessage sendAndReceive(java.lang.String destinationName, MessageCreator messageCreator) throws JmsException
MessageCreator
callback creates the message given a Session. A temporary queue is created as part of this operation and is set in the JMSReplyTO
header of the message.destinationName
- the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)messageCreator
- callback to create a messagenull
if the message could not be received, for example due to a timeoutJmsException
- checked JMSException converted to unchecked<T> T browse(<any> action) throws JmsException
action
- callback object that exposes the session/browser pairJmsException
- checked JMSException converted to unchecked<T> T browse(java.lang.String queueName, <any> action) throws JmsException
queueName
- the name of the queue to browse (to be resolved to an actual destination by a DestinationResolver)action
- callback object that exposes the session/browser pairJmsException
- checked JMSException converted to unchecked<T> T browseSelected(java.lang.String messageSelector, <any> action) throws JmsException
messageSelector
- the JMS message selector expression (or null
if none). See the JMS specification for a detailed definition of selector expressions.action
- callback object that exposes the session/browser pairJmsException
- checked JMSException converted to unchecked<T> T browseSelected(java.lang.String queueName, java.lang.String messageSelector, <any> action) throws JmsException
queueName
- the name of the queue to browse (to be resolved to an actual destination by a DestinationResolver)messageSelector
- the JMS message selector expression (or null
if none). See the JMS specification for a detailed definition of selector expressions.action
- callback object that exposes the session/browser pairJmsException
- checked JMSException converted to uncheckedCopyright © Actionsoft Co., Ltd. All Rights Reserved.