Class AMQPSessionCallback
- java.lang.Object
-
- org.apache.activemq.artemis.protocol.amqp.broker.AMQPSessionCallback
-
- All Implemented Interfaces:
SessionCallback
public class AMQPSessionCallback extends Object implements SessionCallback
-
-
Field Summary
Fields Modifier and Type Field Description protected IDGeneratorconsumerIDGenerator
-
Constructor Summary
Constructors Constructor Description AMQPSessionCallback(AMQPConnectionCallback protonSPI, ProtonProtocolManager manager, AMQPConnectionContext connection, Connection transportConnection, Executor executor, org.apache.activemq.artemis.core.persistence.OperationContext operationContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidack(org.apache.activemq.artemis.core.transaction.Transaction transaction, Object brokerConsumer, Message message)AMQPSessionCallbackaddMetaData(String key, String value)Adds key / value based metadata into the underlying server session implementation for use by the connection resources.voidaddProducer(String name, String address)org.apache.activemq.artemis.core.server.AddressQueryResultaddressQuery(SimpleString addressName, RoutingType routingType, boolean autoCreate)voidafterDelivery()voidafterIO(IOCallback ioCallback)voidbrowserFinished(org.apache.activemq.artemis.core.server.ServerConsumer consumer)voidcancel(Object brokerConsumer, Message message, boolean updateCounts)voidcheck(SimpleString address, org.apache.activemq.artemis.core.security.CheckType checkType, org.apache.activemq.artemis.core.security.SecurityAuth session)booleancheckAddressAndAutocreateIfPossible(SimpleString address, RoutingType routingType)voidclose()voidclose(boolean failed)voidclosed()voidcloseSender(Object brokerConsumer)org.apache.activemq.artemis.core.server.ServerConsumercreateSender(ProtonServerSenderContext protonSender, SimpleString queue, String filter, boolean browserOnly)Creates a server consume that reads from the given named queue and forwards the read messages to the AMQP sender to dispatch to the remote peer.org.apache.activemq.artemis.core.server.ServerConsumercreateSender(ProtonServerSenderContext protonSender, SimpleString queue, String filter, boolean browserOnly, Number priority)Creates a server consume that reads from the given named queue and forwards the read messages to the AMQP sender to dispatch to the remote peer.voidcreateSharedDurableQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter)voidcreateSharedVolatileQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter)AMQPStandardMessagecreateStandardMessage(org.apache.qpid.proton.engine.Delivery delivery, org.apache.qpid.proton.codec.ReadableBuffer data)voidcreateTemporaryQueue(SimpleString queueName, RoutingType routingType)voidcreateTemporaryQueue(SimpleString queueName, RoutingType routingType, Integer maxConsumers)voidcreateTemporaryQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filter)voidcreateTemporaryQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filter, Integer maxConsumers)voidcreateUnsharedDurableQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter)voiddeleteQueue(SimpleString queueName)voiddisconnect(org.apache.activemq.artemis.core.server.ServerConsumer consumer, String errorMessage)voidexecute(Runnable run)voidflow(SimpleString address, Runnable runnable)Will execute a Runnable on an Address when there's space in memoryorg.apache.activemq.artemis.core.server.impl.AddressInfogetAddress(SimpleString address)AMQPSessionContextgetAMQPSessionContext()org.apache.activemq.artemis.core.persistence.CoreMessageObjectPoolsgetCoreMessageObjectPools()org.apache.activemq.artemis.core.transaction.TransactiongetCurrentTransaction()RoutingTypegetDefaultRoutingType(SimpleString address)SimpleStringgetMatchingQueue(SimpleString address, RoutingType routingType)SimpleStringgetMatchingQueue(SimpleString address, SimpleString queueName, RoutingType routingType)ProtonProtocolManagergetProtocolManager()RoutingTypegetRoutingTypeFromPrefix(SimpleString address, RoutingType defaultRoutingType)org.apache.activemq.artemis.core.persistence.OperationContextgetSessionContext()org.apache.activemq.artemis.core.persistence.StorageManagergetStorageManager()org.apache.activemq.artemis.core.transaction.TransactiongetTransaction(org.apache.qpid.proton.amqp.Binary txid, boolean remove)ProtonTransactionHandlergetTransactionHandler()ConnectiongetTransportConnection()booleanhasCredits(org.apache.activemq.artemis.core.server.ServerConsumer consumer)voidinit(AMQPSessionContext protonSession, SASLResult saslResult)StringinvokeIncoming(Message message, ActiveMQProtonRemotingConnection connection)StringinvokeOutgoing(Message message, ActiveMQProtonRemotingConnection connection)booleanisWritable(ReadyListener callback, Object protocolContext)org.apache.qpid.proton.amqp.BinarynewTransaction()org.apache.activemq.artemis.core.server.QueueQueryResultqueueQuery(QueueConfiguration configuration, boolean autoCreate)org.apache.activemq.artemis.core.server.QueueQueryResultqueueQuery(SimpleString queueName, RoutingType routingType, boolean autoCreate)org.apache.activemq.artemis.core.server.QueueQueryResultqueueQuery(SimpleString queueName, RoutingType routingType, boolean autoCreate, SimpleString filter)org.apache.activemq.artemis.core.persistence.OperationContextrecoverContext()voidreject(Object brokerConsumer, Message message)SimpleStringremovePrefix(SimpleString address)voidremoveProducer(String name)voidremoveTemporaryQueue(SimpleString address)voidresetContext(org.apache.activemq.artemis.core.persistence.OperationContext oldContext)voidresumeDelivery(Object consumer)intsendLargeMessage(org.apache.activemq.artemis.core.server.MessageReference ref, org.apache.activemq.artemis.core.server.ServerConsumer consumer, long bodySize, int deliveryCount)intsendLargeMessageContinuation(org.apache.activemq.artemis.core.server.ServerConsumer consumer, byte[] body, boolean continues, boolean requiresResponse)intsendMessage(org.apache.activemq.artemis.core.server.MessageReference ref, org.apache.activemq.artemis.core.server.ServerConsumer consumer, int deliveryCount)voidsendProducerCreditsFailMessage(int credits, SimpleString address)voidsendProducerCreditsMessage(int credits, SimpleString address)voidserverSend(ProtonServerReceiverContext context, org.apache.activemq.artemis.core.transaction.Transaction transaction, org.apache.qpid.proton.engine.Receiver receiver, org.apache.qpid.proton.engine.Delivery delivery, SimpleString address, org.apache.activemq.artemis.core.server.RoutingContext routingContext, Message message)voidsetTransactionHandler(ProtonTransactionHandler transactionHandler)voidstart()voidstartSender(Object brokerConsumer)booleansupportsDirectDelivery()StringtempQueueName()booleanupdateDeliveryCountAfterCancel(org.apache.activemq.artemis.core.server.ServerConsumer consumer, org.apache.activemq.artemis.core.server.MessageReference ref, boolean failed)voidwithinContext(Runnable run)voidwithinSessionExecutor(Runnable run)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.spi.core.protocol.SessionCallback
hasCredits
-
-
-
-
Field Detail
-
consumerIDGenerator
protected final IDGenerator consumerIDGenerator
-
-
Constructor Detail
-
AMQPSessionCallback
public AMQPSessionCallback(AMQPConnectionCallback protonSPI, ProtonProtocolManager manager, AMQPConnectionContext connection, Connection transportConnection, Executor executor, org.apache.activemq.artemis.core.persistence.OperationContext operationContext)
-
-
Method Detail
-
getStorageManager
public org.apache.activemq.artemis.core.persistence.StorageManager getStorageManager()
-
getCoreMessageObjectPools
public org.apache.activemq.artemis.core.persistence.CoreMessageObjectPools getCoreMessageObjectPools()
-
getAMQPSessionContext
public AMQPSessionContext getAMQPSessionContext()
-
getProtocolManager
public ProtonProtocolManager getProtocolManager()
-
isWritable
public boolean isWritable(ReadyListener callback, Object protocolContext)
- Specified by:
isWritablein interfaceSessionCallback
-
withinSessionExecutor
public void withinSessionExecutor(Runnable run)
-
execute
public void execute(Runnable run)
-
afterIO
public void afterIO(IOCallback ioCallback)
-
getSessionContext
public org.apache.activemq.artemis.core.persistence.OperationContext getSessionContext()
-
browserFinished
public void browserFinished(org.apache.activemq.artemis.core.server.ServerConsumer consumer)
- Specified by:
browserFinishedin interfaceSessionCallback
-
supportsDirectDelivery
public boolean supportsDirectDelivery()
- Specified by:
supportsDirectDeliveryin interfaceSessionCallback
-
init
public void init(AMQPSessionContext protonSession, SASLResult saslResult) throws Exception
- Throws:
Exception
-
afterDelivery
public void afterDelivery() throws Exception- Specified by:
afterDeliveryin interfaceSessionCallback- Throws:
Exception
-
start
public void start()
-
createSender
public org.apache.activemq.artemis.core.server.ServerConsumer createSender(ProtonServerSenderContext protonSender, SimpleString queue, String filter, boolean browserOnly) throws Exception
Creates a server consume that reads from the given named queue and forwards the read messages to the AMQP sender to dispatch to the remote peer. The consumer priority value is extracted from the remote link properties that were assigned by the remote receiver.- Parameters:
protonSender- TheProtonServerReceiverContextthat will be attached to the resulting consumerqueue- The target queue that the consumer reads from.filter- The filter assigned to the consumer of the target queue.browserOnly- Should the consumer act as a browser on the target queue.- Returns:
- a new
ServerConsumerattached to the given queue. - Throws:
Exception- if an error occurs while creating the consumer instance.
-
createSender
public org.apache.activemq.artemis.core.server.ServerConsumer createSender(ProtonServerSenderContext protonSender, SimpleString queue, String filter, boolean browserOnly, Number priority) throws Exception
Creates a server consume that reads from the given named queue and forwards the read messages to the AMQP sender to dispatch to the remote peer.- Parameters:
protonSender- TheProtonServerReceiverContextthat will be attached to the resulting consumerqueue- The target queue that the consumer reads from.filter- The filter assigned to the consumer of the target queue.browserOnly- Should the consumer act as a browser on the target queue.priority- The priority to assign the new consumer (server defaults are used if not set).- Returns:
- a new
ServerConsumerattached to the given queue. - Throws:
Exception- if an error occurs while creating the consumer instance.
-
createTemporaryQueue
public void createTemporaryQueue(SimpleString queueName, RoutingType routingType) throws Exception
- Throws:
Exception
-
createTemporaryQueue
public void createTemporaryQueue(SimpleString queueName, RoutingType routingType, Integer maxConsumers) throws Exception
- Throws:
Exception
-
createTemporaryQueue
public void createTemporaryQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filter) throws Exception
- Throws:
Exception
-
createTemporaryQueue
public void createTemporaryQueue(SimpleString address, SimpleString queueName, RoutingType routingType, SimpleString filter, Integer maxConsumers) throws Exception
- Throws:
Exception
-
createUnsharedDurableQueue
public void createUnsharedDurableQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter) throws Exception
- Throws:
Exception
-
createSharedDurableQueue
public void createSharedDurableQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter) throws Exception
- Throws:
Exception
-
createSharedVolatileQueue
public void createSharedVolatileQueue(SimpleString address, RoutingType routingType, SimpleString queueName, SimpleString filter) throws Exception
- Throws:
Exception
-
queueQuery
public org.apache.activemq.artemis.core.server.QueueQueryResult queueQuery(QueueConfiguration configuration, boolean autoCreate) throws Exception
- Throws:
Exception
-
queueQuery
public org.apache.activemq.artemis.core.server.QueueQueryResult queueQuery(SimpleString queueName, RoutingType routingType, boolean autoCreate) throws Exception
- Throws:
Exception
-
queueQuery
public org.apache.activemq.artemis.core.server.QueueQueryResult queueQuery(SimpleString queueName, RoutingType routingType, boolean autoCreate, SimpleString filter) throws Exception
- Throws:
Exception
-
checkAddressAndAutocreateIfPossible
public boolean checkAddressAndAutocreateIfPossible(SimpleString address, RoutingType routingType) throws Exception
- Throws:
Exception
-
addressQuery
public org.apache.activemq.artemis.core.server.AddressQueryResult addressQuery(SimpleString addressName, RoutingType routingType, boolean autoCreate) throws Exception
- Throws:
Exception
-
removePrefix
public SimpleString removePrefix(SimpleString address)
-
tempQueueName
public String tempQueueName()
-
close
public void close(boolean failed)
- Specified by:
closein interfaceSessionCallback
-
ack
public void ack(org.apache.activemq.artemis.core.transaction.Transaction transaction, Object brokerConsumer, Message message) throws Exception- Throws:
Exception
-
cancel
public void cancel(Object brokerConsumer, Message message, boolean updateCounts) throws Exception
- Throws:
Exception
-
reject
public void reject(Object brokerConsumer, Message message) throws Exception
- Throws:
Exception
-
resumeDelivery
public void resumeDelivery(Object consumer)
-
createStandardMessage
public AMQPStandardMessage createStandardMessage(org.apache.qpid.proton.engine.Delivery delivery, org.apache.qpid.proton.codec.ReadableBuffer data)
-
serverSend
public void serverSend(ProtonServerReceiverContext context, org.apache.activemq.artemis.core.transaction.Transaction transaction, org.apache.qpid.proton.engine.Receiver receiver, org.apache.qpid.proton.engine.Delivery delivery, SimpleString address, org.apache.activemq.artemis.core.server.RoutingContext routingContext, Message message) throws Exception
- Throws:
Exception
-
flow
public void flow(SimpleString address, Runnable runnable)
Will execute a Runnable on an Address when there's space in memory
-
deleteQueue
public void deleteQueue(SimpleString queueName) throws Exception
- Throws:
Exception
-
resetContext
public void resetContext(org.apache.activemq.artemis.core.persistence.OperationContext oldContext)
-
recoverContext
public org.apache.activemq.artemis.core.persistence.OperationContext recoverContext()
-
sendProducerCreditsMessage
public void sendProducerCreditsMessage(int credits, SimpleString address)- Specified by:
sendProducerCreditsMessagein interfaceSessionCallback
-
updateDeliveryCountAfterCancel
public boolean updateDeliveryCountAfterCancel(org.apache.activemq.artemis.core.server.ServerConsumer consumer, org.apache.activemq.artemis.core.server.MessageReference ref, boolean failed)- Specified by:
updateDeliveryCountAfterCancelin interfaceSessionCallback
-
sendProducerCreditsFailMessage
public void sendProducerCreditsFailMessage(int credits, SimpleString address)- Specified by:
sendProducerCreditsFailMessagein interfaceSessionCallback
-
sendMessage
public int sendMessage(org.apache.activemq.artemis.core.server.MessageReference ref, org.apache.activemq.artemis.core.server.ServerConsumer consumer, int deliveryCount)- Specified by:
sendMessagein interfaceSessionCallback
-
sendLargeMessage
public int sendLargeMessage(org.apache.activemq.artemis.core.server.MessageReference ref, org.apache.activemq.artemis.core.server.ServerConsumer consumer, long bodySize, int deliveryCount)- Specified by:
sendLargeMessagein interfaceSessionCallback
-
sendLargeMessageContinuation
public int sendLargeMessageContinuation(org.apache.activemq.artemis.core.server.ServerConsumer consumer, byte[] body, boolean continues, boolean requiresResponse)- Specified by:
sendLargeMessageContinuationin interfaceSessionCallback
-
closed
public void closed()
- Specified by:
closedin interfaceSessionCallback
-
disconnect
public void disconnect(org.apache.activemq.artemis.core.server.ServerConsumer consumer, String errorMessage)- Specified by:
disconnectin interfaceSessionCallback
-
hasCredits
public boolean hasCredits(org.apache.activemq.artemis.core.server.ServerConsumer consumer)
- Specified by:
hasCreditsin interfaceSessionCallback
-
getCurrentTransaction
public org.apache.activemq.artemis.core.transaction.Transaction getCurrentTransaction()
- Specified by:
getCurrentTransactionin interfaceSessionCallback
-
addMetaData
public AMQPSessionCallback addMetaData(String key, String value) throws Exception
Adds key / value based metadata into the underlying server session implementation for use by the connection resources.- Parameters:
key- The key to add into the linked server session.value- The value to add into the linked server session attached to the given key.- Returns:
- this
AMQPSessionCallbackinstance. - Throws:
Exception- if an error occurs while adding the metadata.
-
getTransaction
public org.apache.activemq.artemis.core.transaction.Transaction getTransaction(org.apache.qpid.proton.amqp.Binary txid, boolean remove) throws ActiveMQAMQPException- Throws:
ActiveMQAMQPException
-
newTransaction
public org.apache.qpid.proton.amqp.Binary newTransaction()
-
getMatchingQueue
public SimpleString getMatchingQueue(SimpleString address, RoutingType routingType) throws Exception
- Throws:
Exception
-
getMatchingQueue
public SimpleString getMatchingQueue(SimpleString address, SimpleString queueName, RoutingType routingType) throws Exception
- Throws:
Exception
-
getAddress
public org.apache.activemq.artemis.core.server.impl.AddressInfo getAddress(SimpleString address)
-
removeTemporaryQueue
public void removeTemporaryQueue(SimpleString address) throws Exception
- Throws:
Exception
-
getDefaultRoutingType
public RoutingType getDefaultRoutingType(SimpleString address)
-
getRoutingTypeFromPrefix
public RoutingType getRoutingTypeFromPrefix(SimpleString address, RoutingType defaultRoutingType)
-
check
public void check(SimpleString address, org.apache.activemq.artemis.core.security.CheckType checkType, org.apache.activemq.artemis.core.security.SecurityAuth session) throws Exception
- Throws:
Exception
-
invokeIncoming
public String invokeIncoming(Message message, ActiveMQProtonRemotingConnection connection)
-
invokeOutgoing
public String invokeOutgoing(Message message, ActiveMQProtonRemotingConnection connection)
-
removeProducer
public void removeProducer(String name)
-
setTransactionHandler
public void setTransactionHandler(ProtonTransactionHandler transactionHandler)
-
getTransportConnection
public Connection getTransportConnection()
-
getTransactionHandler
public ProtonTransactionHandler getTransactionHandler()
-
-