Class ClientProducerImpl
- All Implemented Interfaces:
AutoCloseable,ClientProducer,ClientProducerInternal
-
Constructor Summary
ConstructorsConstructorDescriptionClientProducerImpl(ClientSessionInternal session, SimpleString address, TokenBucketLimiter rateLimiter, boolean blockOnNonDurableSend, boolean blockOnDurableSend, boolean autoGroup, SimpleString groupID, int minLargeMessageSize, SessionContext sessionContext, int producerID) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp()voidclose()Closes the ClientProducer.Returns the address where messages will be sent; the address can benullif theClientProducerwas created without specifying an address, e.g. by usingClientSession.createProducer().intgetID()intReturns the maximum rate at which a ClientProducer can send messages per second.booleanReturnstrueif the producer blocks when sending durable messages,falseelse.booleanReturnstrueif the producer blocks when sending non-durable messages,falseelse.booleanisClosed()Returnstrueif the producer is closed,falseelse.voidSends a message to the specified address instead of the ClientProducer's address.voidSends a message to an address. specified inClientSession.createProducer(String)or similar methods.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 Details
-
ClientProducerImpl
public ClientProducerImpl(ClientSessionInternal session, SimpleString address, TokenBucketLimiter rateLimiter, boolean blockOnNonDurableSend, boolean blockOnDurableSend, boolean autoGroup, SimpleString groupID, int minLargeMessageSize, SessionContext sessionContext, int producerID)
-
-
Method Details
-
getAddress
Description copied from interface:ClientProducerReturns the address where messages will be sent; the address can benullif theClientProducerwas created without specifying an address, e.g. by usingClientSession.createProducer().- Specified by:
getAddressin interfaceClientProducer- Returns:
- the address where messages will be sent; the address can be
nullif theClientProducerwas created without specifying an address, e.g. by usingClientSession.createProducer()
-
send
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 if
ServerLocator.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
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 if
ServerLocator.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
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 if
ServerLocator.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 as
ServerLocator.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
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
Description 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:ClientProducerReturnstrueif the producer is closed,falseelse.- Specified by:
isClosedin interfaceClientProducer- Returns:
trueif the producer is closed,falseelse
-
isBlockOnDurableSend
public boolean isBlockOnDurableSend()Description copied from interface:ClientProducerReturnstrueif the producer blocks when sending durable messages,falseelse.- Specified by:
isBlockOnDurableSendin interfaceClientProducer- Returns:
trueif the producer blocks when sending durable messages,falseelse
-
isBlockOnNonDurableSend
public boolean isBlockOnNonDurableSend()Description copied from interface:ClientProducerReturnstrueif the producer blocks when sending non-durable messages,falseelse.- Specified by:
isBlockOnNonDurableSendin interfaceClientProducer- Returns:
trueif the producer blocks when sending non-durable messages,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 maximum rate at which a ClientProducer can send messages per second
-
getProducerCredits
- Specified by:
getProducerCreditsin interfaceClientProducerInternal
-
getID
public int getID()- Specified by:
getIDin interfaceClientProducerInternal
-