|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ClientProducer
A ClientProducer is used to send messages to a specific address. Messages are then routed on the server to any queues
that are bound to the address. A ClientProducer can either be created with a specific address in mind or with none.
With the latter the address must be provided using the appropriate send() method.
The sending semantics can change depending on what blocking semantics are set via ClientSessionFactory#setBlockOnDurableSend(boolean)
and org.hornetq.api.core.client.ClientSessionFactory#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 ClientSessionFactory#setProducerMaxRate(int)
and the org.hornetq.api.core.client.ClientSessionFactory#setProducerWindowSize(int)
.
Method Summary | |
---|---|
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(SimpleString address,
Message message)
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. |
Method Detail |
---|
SimpleString getAddress()
null
if the ClientProducer
was creating without specifying an address, that is by using ClientSession.createProducer()
.
void send(Message message) throws HornetQException
ClientSession.createProducer(String)
or similar methods.
ClientSessionFactory#setBlockOnDurableSend(boolean)
or org.hornetq.api.core.client.ClientSessionFactory#setBlockOnNonDurableSend(boolean)
are set to true
for the specified message type.
message
- the message to send
HornetQException
- if an exception occurs while sending the messagevoid send(SimpleString address, Message message) throws HornetQException
ClientSessionFactory#setBlockOnDurableSend(boolean)
or org.hornetq.api.core.client.ClientSessionFactory#setBlockOnNonDurableSend(boolean)
are set to true for the specified message type.
address
- the address where the message will be sentmessage
- the message to send
HornetQException
- if an exception occurs while sending the messagevoid send(String address, Message message) throws HornetQException
ClientSessionFactory#setBlockOnDurableSend(boolean)
or org.hornetq.api.core.client.ClientSessionFactory#setBlockOnNonDurableSend(boolean)
are set to true for the specified message type.
address
- the address where the message will be sentmessage
- the message to send
HornetQException
- if an exception occurs while sending the messagevoid close() throws HornetQException
HornetQException
- 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |