public class AmqpConsumer extends AmqpAbstractResource<JmsConsumerInfo,org.apache.qpid.proton.engine.Receiver>
Modifier and Type | Class and Description |
---|---|
protected static class |
AmqpConsumer.ScheduledStopRequest |
Modifier and Type | Field and Description |
---|---|
protected Map<JmsInboundMessageDispatch,org.apache.qpid.proton.engine.Delivery> |
delivered |
protected io.netty.buffer.ByteBuf |
incomingBuffer |
protected AtomicLong |
incomingSequence |
protected boolean |
presettle |
protected AsyncResult |
pullRequest |
protected AmqpSession |
session |
protected AsyncResult |
stopRequest |
closeRequest, closeTimeoutTask
Constructor and Description |
---|
AmqpConsumer(AmqpSession session,
JmsConsumerInfo info,
org.apache.qpid.proton.engine.Receiver receiver) |
Modifier and Type | Method and Description |
---|---|
void |
acknowledge(JmsInboundMessageDispatch envelope,
ProviderConstants.ACK_TYPE ackType)
Called to acknowledge a given delivery.
|
void |
acknowledge(ProviderConstants.ACK_TYPE ackType)
Called to acknowledge all messages that have been marked as delivered but
have not yet been marked consumed.
|
protected void |
closeOrDetachEndpoint()
Perform the close operation on the managed endpoint.
|
protected org.apache.qpid.proton.message.Message |
decodeIncomingMessage(org.apache.qpid.proton.engine.Delivery incoming) |
protected void |
deliver(JmsInboundMessageDispatch envelope) |
protected void |
deliveryFailedUndeliverable(org.apache.qpid.proton.engine.Delivery incoming) |
AmqpConnection |
getConnection() |
JmsConsumerId |
getConsumerId() |
JmsDestination |
getDestination() |
protected long |
getNextIncomingSequenceNumber() |
AmqpSession |
getSession() |
boolean |
isPresettle() |
boolean |
isStopping() |
void |
postCommit() |
void |
postRollback() |
void |
preCommit() |
void |
preRollback() |
void |
processDeliveryUpdates(AmqpProvider provider)
Called when the Proton Engine signals an Delivery related event has been triggered
for the given endpoint.
|
void |
processFlowUpdates(AmqpProvider provider)
Called when the Proton Engine signals an Flow related event has been triggered
for the given endpoint.
|
void |
pull(long timeout,
AsyncResult request)
Request a remote peer send a Message to this client.
|
void |
recover()
Recovers all previously delivered but not acknowledged messages.
|
void |
setPresettle(boolean presettle) |
void |
start(AsyncResult request)
Starts the consumer by setting the link credit to the given prefetch value.
|
void |
stop(AsyncResult request)
Stops the consumer, using all link credit and waiting for in-flight messages to arrive.
|
String |
toString() |
close, getEndpoint, getLocalState, getParent, getRemoteState, getResourceInfo, isAwaitingClose, isClosed, isOpen, processRemoteClose, processRemoteDetach, processRemoteOpen, remotelyClosed, resourceClosed
protected final AmqpSession session
protected final Map<JmsInboundMessageDispatch,org.apache.qpid.proton.engine.Delivery> delivered
protected boolean presettle
protected AsyncResult stopRequest
protected AsyncResult pullRequest
protected final io.netty.buffer.ByteBuf incomingBuffer
protected final AtomicLong incomingSequence
public AmqpConsumer(AmqpSession session, JmsConsumerInfo info, org.apache.qpid.proton.engine.Receiver receiver)
public void start(AsyncResult request)
request
- The request that awaits completion of the consumer start.public void stop(AsyncResult request)
request
- The request that awaits completion of the consumer stop.public void processFlowUpdates(AmqpProvider provider) throws IOException
AmqpEventSink
processFlowUpdates
in interface AmqpEventSink
processFlowUpdates
in class AmqpAbstractResource<JmsConsumerInfo,org.apache.qpid.proton.engine.Receiver>
provider
- the AmqpProvider instance for easier access to fire events.IOException
- if an error occurs while processing the update.public void acknowledge(ProviderConstants.ACK_TYPE ackType)
ackType
- the type of acknowledgement to performpublic void acknowledge(JmsInboundMessageDispatch envelope, ProviderConstants.ACK_TYPE ackType) throws javax.jms.JMSException
envelope
- the delivery that is to be acknowledged.ackType
- the type of acknowledgment to perform.javax.jms.JMSException
- if an error occurs accessing the Message properties.public void recover() throws Exception
Exception
- if an error occurs while performing the recover.public void pull(long timeout, AsyncResult request)
timeout
- the amount of time to tell the remote peer to keep this pull request valid.request
- the asynchronous request object waiting to be notified of the pull having completed.public void processDeliveryUpdates(AmqpProvider provider) throws IOException
AmqpEventSink
processDeliveryUpdates
in interface AmqpEventSink
processDeliveryUpdates
in class AmqpAbstractResource<JmsConsumerInfo,org.apache.qpid.proton.engine.Receiver>
provider
- the AmqpProvider instance for easier access to fire events.IOException
- if an error occurs while processing the update.protected long getNextIncomingSequenceNumber()
protected void closeOrDetachEndpoint()
AmqpAbstractResource
closeOrDetachEndpoint
in class AmqpAbstractResource<JmsConsumerInfo,org.apache.qpid.proton.engine.Receiver>
public AmqpConnection getConnection()
public AmqpSession getSession()
public JmsConsumerId getConsumerId()
public JmsDestination getDestination()
public boolean isPresettle()
public boolean isStopping()
public void setPresettle(boolean presettle)
protected void deliveryFailedUndeliverable(org.apache.qpid.proton.engine.Delivery incoming)
protected void deliver(JmsInboundMessageDispatch envelope) throws Exception
Exception
protected org.apache.qpid.proton.message.Message decodeIncomingMessage(org.apache.qpid.proton.engine.Delivery incoming)
public void preCommit()
public void preRollback()
public void postCommit()
public void postRollback()
Copyright © 2013–2016 The Apache Software Foundation. All rights reserved.