Class ClientProducerImpl
- java.lang.Object
-
- org.apache.activemq.artemis.core.client.impl.ClientProducerImpl
-
- All Implemented Interfaces:
AutoCloseable,ClientProducer,ClientProducerInternal
public class ClientProducerImpl extends Object implements ClientProducerInternal
The client-side Producer.
-
-
Constructor Summary
Constructors Constructor Description ClientProducerImpl(ClientSessionInternal session, SimpleString address, TokenBucketLimiter rateLimiter, boolean blockOnNonDurableSend, boolean blockOnDurableSend, boolean autoGroup, SimpleString groupID, int minLargeMessageSize, SessionContext sessionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUp()voidclose()Closes the ClientProducer.SimpleStringgetAddress()Returns the address where messages will be sent.intgetMaxRate()Returns the maximum rate at which a ClientProducer can send messages per second.ClientProducerCreditsgetProducerCredits()booleanisBlockOnDurableSend()Returns whether the producer will block when sending durable messages.booleanisBlockOnNonDurableSend()Returns whether the producer will block when sending non-durable messages.booleanisClosed()Returns whether the producer is closed or not.voidsend(String address1, Message message)Sends a message to the specified address instead of the ClientProducer's address.voidsend(Message msg)Sends a message to an address.voidsend(Message message, SendAcknowledgementHandler handler)Sends a message to the specified address instead of the ClientProducer's address.voidsend(SimpleString address1, Message msg)Sends a message to the specified address instead of the ClientProducer's address.voidsend(SimpleString address1, Message message, SendAcknowledgementHandler handler)Sends a message to the specified address instead of the ClientProducer's address.
-
-
-
Constructor Detail
-
ClientProducerImpl
public ClientProducerImpl(ClientSessionInternal session, SimpleString address, TokenBucketLimiter rateLimiter, boolean blockOnNonDurableSend, boolean blockOnDurableSend, boolean autoGroup, SimpleString groupID, int minLargeMessageSize, SessionContext sessionContext)
-
-
Method Detail
-
getAddress
public SimpleString getAddress()
Description copied from interface:ClientProducerReturns the address where messages will be sent.
The address can benullif the ClientProducer was creating without specifying an address, that is by usingClientSession.createProducer().- Specified by:
getAddressin interfaceClientProducer- Returns:
- the address where messages will be sent
-
send
public void send(Message msg) throws ActiveMQException
Description copied from interface:ClientProducerSends a message to an address. specified inClientSession.createProducer(String)or similar methods.
This will block until confirmation that the message has reached the server has been received ifServerLocator.setBlockOnDurableSend(boolean)orServerLocator.setBlockOnNonDurableSend(boolean)are set totruefor the specified message type.- Specified by:
sendin interfaceClientProducer- Parameters:
msg- the message to send- Throws:
ActiveMQException- if an exception occurs while sending the message
-
send
public void send(SimpleString address1, Message msg) throws ActiveMQException
Description copied from interface:ClientProducerSends a message to the specified address instead of the ClientProducer's address.
This will block until confirmation that the message has reached the server has been received ifServerLocator.setBlockOnDurableSend(boolean)orServerLocator.setBlockOnNonDurableSend(boolean)are set to true for the specified message type.- Specified by:
sendin interfaceClientProducer- Parameters:
address1- the address where the message will be sentmsg- the message to send- Throws:
ActiveMQException- if an exception occurs while sending the message
-
send
public void send(String address1, Message message) throws ActiveMQException
Description copied from interface:ClientProducerSends a message to the specified address instead of the ClientProducer's address.
This will block until confirmation that the message has reached the server has been received ifServerLocator.setBlockOnDurableSend(boolean)orServerLocator.setBlockOnNonDurableSend(boolean)are set to true for the specified message type.- Specified by:
sendin interfaceClientProducer- Parameters:
address1- the address where the message will be sentmessage- the message to send- Throws:
ActiveMQException- if an exception occurs while sending the message
-
send
public void send(SimpleString address1, Message message, SendAcknowledgementHandler handler) throws ActiveMQException
Description copied from interface:ClientProducerSends a message to the specified address instead of the ClientProducer's address.
This message will be sent asynchronously as long asServerLocator.setConfirmationWindowSize(int)was set.Notice that if no confirmationWindowsize is set
- Specified by:
sendin interfaceClientProducer- Parameters:
address1- the address where the message will be sentmessage- the message to sendhandler- handler to call after receiving a SEND acknowledgement from the server- Throws:
ActiveMQException- if an exception occurs while sending the message
-
send
public void send(Message message, SendAcknowledgementHandler handler) throws ActiveMQException
Description copied from interface:ClientProducerSends a message to the specified address instead of the ClientProducer's address.
This message will be sent asynchronously.The handler will only get called if
-1.- Specified by:
sendin interfaceClientProducer- Parameters:
message- the message to sendhandler- handler to call after receiving a SEND acknowledgement from the server- Throws:
ActiveMQException- if an exception occurs while sending the message
-
close
public void close() throws ActiveMQExceptionDescription copied from interface:ClientProducerCloses the ClientProducer. If already closed nothing is done.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceClientProducer- Throws:
ActiveMQException- if an exception occurs while closing the producer
-
cleanUp
public void cleanUp()
- Specified by:
cleanUpin interfaceClientProducerInternal
-
isClosed
public boolean isClosed()
Description copied from interface:ClientProducerReturns whether the producer is closed or not.- Specified by:
isClosedin interfaceClientProducer- Returns:
trueif the producer is closed,falseelse
-
isBlockOnDurableSend
public boolean isBlockOnDurableSend()
Description copied from interface:ClientProducerReturns whether the producer will block when sending durable messages.- Specified by:
isBlockOnDurableSendin interfaceClientProducer- Returns:
trueif the producer blocks when sending durable,falseelse
-
isBlockOnNonDurableSend
public boolean isBlockOnNonDurableSend()
Description copied from interface:ClientProducerReturns whether the producer will block when sending non-durable messages.- Specified by:
isBlockOnNonDurableSendin interfaceClientProducer- Returns:
trueif the producer blocks when sending non-durable,falseelse
-
getMaxRate
public int getMaxRate()
Description copied from interface:ClientProducerReturns the maximum rate at which a ClientProducer can send messages per second.- Specified by:
getMaxRatein interfaceClientProducer- Returns:
- the producers maximum rate
-
getProducerCredits
public ClientProducerCredits getProducerCredits()
- Specified by:
getProducerCreditsin interfaceClientProducerInternal
-
-