Interface JmsMessage<PAYLOAD>
-
- Type Parameters:
PAYLOAD
- Type of the payload.
- All Superinterfaces:
Message<PAYLOAD>
- All Known Subinterfaces:
AqMessage<T>
- All Known Implementing Classes:
JmsBytesMessage
,JmsTextMessage
public interface JmsMessage<PAYLOAD> extends Message<PAYLOAD>
Message representing JMS message together with all the metadata.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
JmsMessage.CustomMapper<PAYLOAD>
Mapper for creatingMessage
.static class
JmsMessage.OutgoingJmsMessageBuilder<PAYLOAD>
Outgoing JMS message builder.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <PAYLOAD> JmsMessage.OutgoingJmsMessageBuilder<PAYLOAD>
builder()
Outgoing JMS message builder.static <PAYLOAD> JmsMessage.OutgoingJmsMessageBuilder<PAYLOAD>
builder(javax.jms.Message msg)
Outgoing JMS message builder.static <PAYLOAD> JmsMessage.OutgoingJmsMessageBuilder<PAYLOAD>
builder(PAYLOAD payload)
Outgoing JMS message builder.default String
getCorrelationId()
Return correlation id of the message.javax.jms.Connection
getJmsConnection()
Get client's connection to its JMS provider.javax.jms.ConnectionFactory
getJmsConnectionFactory()
Get JMS connection factory.<MSG extends javax.jms.Message>
MSGgetJmsMessage()
Original JMS message received.javax.jms.Session
getJmsSession()
Metadata about the JMS session.<P> P
getProperty(String name)
Get JMS property by name.Set<String>
getPropertyNames()
Return set of all JMS property names.default javax.jms.Destination
getReplyTo()
Return reply to destination of the message.default String
getType()
Return type identifier set by sending JMS client.boolean
hasProperty(String name)
Check if JMS property exists.boolean
isAck()
Check if message has been acknowledged yet.static <PAYLOAD> Message<PAYLOAD>
of(PAYLOAD payload)
Create a JmsMessage with the given payload.static <PAYLOAD> Message<PAYLOAD>
of(PAYLOAD payload, Supplier<CompletionStage<Void>> ack)
Create a JmsMessage with the given payload and ack function.-
Methods inherited from interface org.eclipse.microprofile.reactive.messaging.Message
ack, getPayload, unwrap
-
-
-
-
Method Detail
-
getJmsSession
javax.jms.Session getJmsSession()
Metadata about the JMS session.- Returns:
- JMS session
-
getJmsConnection
javax.jms.Connection getJmsConnection()
Get client's connection to its JMS provider.- Returns:
- JMS connection
-
getJmsConnectionFactory
javax.jms.ConnectionFactory getJmsConnectionFactory()
Get JMS connection factory.- Returns:
- JMS connection factory
-
getJmsMessage
<MSG extends javax.jms.Message> MSG getJmsMessage()
Original JMS message received.- Type Parameters:
MSG
- expected sub-type ofMessage
- Returns:
- original JMS message received
- Throws:
ClassCastException
- when original payload cannot be casted to expected type
-
getType
default String getType()
Return type identifier set by sending JMS client.- Returns:
- JMS type or null
-
getCorrelationId
default String getCorrelationId()
Return correlation id of the message.- Returns:
- correlation id or null
-
getReplyTo
default javax.jms.Destination getReplyTo()
Return reply to destination of the message.- Returns:
- destination or null
-
isAck
boolean isAck()
Check if message has been acknowledged yet.- Returns:
- true if message has been acknowledged
-
getProperty
<P> P getProperty(String name)
Get JMS property by name.- Type Parameters:
P
- expected type of the property, has to be Boolean, Byte, Short, Integer, Long, Float, Double or String- Parameters:
name
- the name of the JMS property- Returns:
- property value with the specified name or null
- Throws:
ClassCastException
- when property cannot be casted to expected type
-
hasProperty
boolean hasProperty(String name)
Check if JMS property exists.- Parameters:
name
- the name of the JMS property- Returns:
- true if property exists
-
getPropertyNames
Set<String> getPropertyNames()
Return set of all JMS property names.- Returns:
- JMS property names
-
of
static <PAYLOAD> Message<PAYLOAD> of(PAYLOAD payload, Supplier<CompletionStage<Void>> ack)
Create a JmsMessage with the given payload and ack function.- Type Parameters:
PAYLOAD
- the type of payload- Parameters:
payload
- The payload.ack
- The ack function, this will be invoked when the returned messagesMessage.ack()
method is invoked.- Returns:
- A message with the given payload and ack function.
-
of
static <PAYLOAD> Message<PAYLOAD> of(PAYLOAD payload)
Create a JmsMessage with the given payload.- Type Parameters:
PAYLOAD
- The type of payload- Parameters:
payload
- The payload.- Returns:
- A message with the given payload, and a no-op ack function.
-
builder
static <PAYLOAD> JmsMessage.OutgoingJmsMessageBuilder<PAYLOAD> builder(PAYLOAD payload)
Outgoing JMS message builder. Makes possible to create JMS message with properties.- Type Parameters:
PAYLOAD
- JMS message payload type- Parameters:
payload
- JMS message payload- Returns:
- Message builder
-
builder
static <PAYLOAD> JmsMessage.OutgoingJmsMessageBuilder<PAYLOAD> builder(javax.jms.Message msg)
Outgoing JMS message builder. Makes possible to create JMS message fromMessage
and customize result. Does NOT copy payload, only headers and properties.- Type Parameters:
PAYLOAD
- payload type- Parameters:
msg
-Message
to derive metadata- Returns:
- Message builder
- Throws:
MessagingException
- when JMS provider can't retrieve message body, properties or metadata
-
builder
static <PAYLOAD> JmsMessage.OutgoingJmsMessageBuilder<PAYLOAD> builder()
Outgoing JMS message builder. Makes possible to create JMS message with properties.- Type Parameters:
PAYLOAD
- JMS message payload type- Returns:
- Message builder
-
-