public interface ClientProducer extends AutoCloseable
The sending semantics can change depending on what blocking semantics are set via
ServerLocator.setBlockOnDurableSend(boolean)
and
ServerLocator.setBlockOnNonDurableSend(boolean)
. If set to
true then for each message type, durable and non durable respectively, any exceptions such as the
address not existing or security exceptions will be thrown at the time of send. Alternatively if
set to false then exceptions will only be logged on the server.
The send rate can also be controlled via ServerLocator.setProducerMaxRate(int)
and the
ServerLocator.setProducerWindowSize(int)
.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the ClientProducer.
|
SimpleString |
getAddress()
Returns the address where messages will be sent.
|
int |
getMaxRate()
Returns the maximum rate at which a ClientProducer can send messages per second.
|
boolean |
isBlockOnDurableSend()
Returns whether the producer will block when sending durable messages.
|
boolean |
isBlockOnNonDurableSend()
Returns whether the producer will block when sending non-durable messages.
|
boolean |
isClosed()
Returns whether the producer is closed or not.
|
void |
send(Message message)
Sends a message to an address.
|
void |
send(Message message,
SendAcknowledgementHandler handler)
Sends a message to the specified address instead of the ClientProducer's address.
|
void |
send(SimpleString address,
Message message)
Sends a message to the specified address instead of the ClientProducer's address.
|
void |
send(SimpleString address,
Message message,
SendAcknowledgementHandler handler)
Sends a message to the specified address instead of the ClientProducer's address.
|
void |
send(String address,
Message message)
Sends a message to the specified address instead of the ClientProducer's address.
|
SimpleString getAddress()
null
if the ClientProducer
was creating without specifying an address, that is by using ClientSession.createProducer()
.void send(Message message) throws ActiveMQException
ClientSession.createProducer(String)
or
similar methods. ServerLocator.setBlockOnDurableSend(boolean)
or
ServerLocator.setBlockOnNonDurableSend(boolean)
are set to true
for the
specified message type.message
- the message to sendActiveMQException
- if an exception occurs while sending the messagevoid send(Message message, SendAcknowledgementHandler handler) throws ActiveMQException
The handler will only get called if -1
.
message
- the message to sendhandler
- handler to call after receiving a SEND acknowledgement from the serverActiveMQException
- if an exception occurs while sending the messagevoid send(SimpleString address, Message message) throws ActiveMQException
ServerLocator.setBlockOnDurableSend(boolean)
or
ServerLocator.setBlockOnNonDurableSend(boolean)
are set to true for the specified
message type.address
- the address where the message will be sentmessage
- the message to sendActiveMQException
- if an exception occurs while sending the messagevoid send(SimpleString address, Message message, SendAcknowledgementHandler handler) throws ActiveMQException
ServerLocator.setConfirmationWindowSize(int)
was set.
Notice that if no confirmationWindowsize is set
address
- the address where the message will be sentmessage
- the message to sendhandler
- handler to call after receiving a SEND acknowledgement from the serverActiveMQException
- if an exception occurs while sending the messagevoid send(String address, Message message) throws ActiveMQException
ServerLocator.setBlockOnDurableSend(boolean)
or
ServerLocator.setBlockOnNonDurableSend(boolean)
are set to true for the specified
message type.address
- the address where the message will be sentmessage
- the message to sendActiveMQException
- if an exception occurs while sending the messagevoid close() throws ActiveMQException
close
in interface AutoCloseable
ActiveMQException
- if an exception occurs while closing the producerboolean isClosed()
true
if the producer is closed, false
elseboolean isBlockOnDurableSend()
true
if the producer blocks when sending durable, false
elseboolean isBlockOnNonDurableSend()
true
if the producer blocks when sending non-durable, false
elseint getMaxRate()
Copyright © 2018 JBoss by Red Hat. All rights reserved.