Package org.ow2.joram.mom.amqp
Class Proxy
- java.lang.Object
-
- org.ow2.joram.mom.amqp.Proxy
-
- All Implemented Interfaces:
DeliveryListener,ProxyMBean
public class Proxy extends Object implements DeliveryListener, ProxyMBean
Handles the AMQP frames received by theAMQPConnectionListener.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classProxy.NetServerIn
-
Field Summary
Fields Modifier and Type Field Description private Map<Integer,ChannelContext>channelContextsprivate Set<QueueShell>exclusiveQueuesprivate static Loggerloggerprivate ProxyNamenameprivate Proxy.NetServerInnetServerInstatic StringPREFIX_PXprivate static longproxyIdprivate QueuequeueInprivate QueuequeueOutprivate Transactiontransaction
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbasicAck(AMQP.Basic.Ack ack)voidbasicCancel(String consumerTag, int channelNumber)voidbasicConsume(AMQP.Basic.Consume basicConsume)GetResponsebasicGet(AMQP.Basic.Get basicGet)voidbasicPublish(PublishRequest publishRequest)voidbasicQoS(AMQP.Basic.Qos qos)voidbasicRecover(boolean requeue, int channelNumber)voidbasicReject(AMQP.Basic.Reject basicReject)voidchannelClose(int channelNumber)voidcleanConsumers(short sid)private voidcleanQueueContext(int channelNumber, QueueShell queueShell)private voidcommitTx()voidconnectionClose()booleandeliver(String consumerTag, int channelNumber, Queue queue, short serverId, long proxyId)private voiddoCancel(String consumerTag, int channelNumber, QueueShell queueShell)private intdoGetDeliveries(String consumerTag, int channelId, int maxMessage, Queue queue)protected voiddoProcessMethod(AbstractMarshallingMethod method)voidexchangeDeclare(AMQP.Exchange.Declare exchangeDeclare)voidexchangeDelete(AMQP.Exchange.Delete exchangeDelete)private ChannelContextgetContext(int channelNumber)private voidgetDeliveries(GetDeliveries getDeliveries)Set<String>getExclusiveQueues()private static longgetNextProxyId()Integer[]getOpenedChannels()intgetQueueInSize()intgetQueueOutSize()voidloadProxyId()voidqueueBind(AMQP.Queue.Bind queueBind)AMQP.Queue.DeclareOkqueueDeclare(AMQP.Queue.Declare queueDeclare)AMQP.Queue.DeleteOkqueueDelete(AMQP.Queue.Delete queueDelete)AMQP.Queue.PurgeOkqueuePurge(AMQP.Queue.Purge queuePurge)voidqueueUnbind(AMQP.Queue.Unbind queueUnbind)voidsaveProxyId()voidsend(AbstractMarshallingMethod method)voidsend(Deliver deliver, QueueShell queue)voidsend(GetResponse response)voidsend(Returned response)voidstart()voidstop()private voidthrowException(AMQPException amqe, int channelNumber, int classId, int methodId)Releases connection or channel resources and close it by sending a notification to the client.voidtxCommit(int channelNumber)voidtxRollback(int channelNumber)
-
-
-
Field Detail
-
logger
private static final Logger logger
-
PREFIX_PX
public static final String PREFIX_PX
- See Also:
- Constant Field Values
-
proxyId
private static volatile long proxyId
-
name
private ProxyName name
-
queueIn
private Queue queueIn
-
queueOut
private Queue queueOut
-
netServerIn
private Proxy.NetServerIn netServerIn
-
transaction
private Transaction transaction
-
exclusiveQueues
private Set<QueueShell> exclusiveQueues
-
channelContexts
private Map<Integer,ChannelContext> channelContexts
-
-
Constructor Detail
-
Proxy
public Proxy(Queue queueIn, Queue queueOut) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getNextProxyId
private static long getNextProxyId()
-
loadProxyId
public void loadProxyId() throws IOException- Throws:
IOException
-
saveProxyId
public void saveProxyId() throws IOException- Throws:
IOException
-
doProcessMethod
protected void doProcessMethod(AbstractMarshallingMethod method) throws AMQPException
- Parameters:
method-- Throws:
AMQPException
-
throwException
private void throwException(AMQPException amqe, int channelNumber, int classId, int methodId) throws AMQPException
Releases connection or channel resources and close it by sending a notification to the client.- Throws:
AMQPException
-
commitTx
private void commitTx() throws TransactionException- Throws:
TransactionException
-
getContext
private ChannelContext getContext(int channelNumber)
-
cleanConsumers
public void cleanConsumers(short sid) throws AMQPException- Throws:
AMQPException
-
basicAck
public void basicAck(AMQP.Basic.Ack ack) throws PreconditionFailedException
- Throws:
PreconditionFailedException
-
basicCancel
public void basicCancel(String consumerTag, int channelNumber) throws AMQPException, ResourceLockedException
- Throws:
AMQPExceptionResourceLockedException
-
doCancel
private void doCancel(String consumerTag, int channelNumber, QueueShell queueShell) throws ResourceLockedException, NotFoundException, PreconditionFailedException, AMQPException
-
getDeliveries
private void getDeliveries(GetDeliveries getDeliveries)
-
doGetDeliveries
private int doGetDeliveries(String consumerTag, int channelId, int maxMessage, Queue queue)
-
basicConsume
public void basicConsume(AMQP.Basic.Consume basicConsume) throws NotFoundException, NotAllowedException, AMQPException, AccessRefusedException, ResourceLockedException
-
basicGet
public GetResponse basicGet(AMQP.Basic.Get basicGet) throws NotFoundException, AMQPException, SyntaxErrorException, ResourceLockedException
-
basicPublish
public void basicPublish(PublishRequest publishRequest) throws NotFoundException, TransactionException
-
basicRecover
public void basicRecover(boolean requeue, int channelNumber) throws TransactionException- Throws:
TransactionException
-
basicReject
public void basicReject(AMQP.Basic.Reject basicReject) throws TransactionException, PreconditionFailedException
-
basicQoS
public void basicQoS(AMQP.Basic.Qos qos) throws NotImplementedException
- Throws:
NotImplementedException
-
channelClose
public void channelClose(int channelNumber) throws AMQPException- Throws:
AMQPException
-
connectionClose
public void connectionClose()
-
exchangeDeclare
public void exchangeDeclare(AMQP.Exchange.Declare exchangeDeclare) throws CommandInvalidException, NotAllowedException, NotFoundException, AMQPException
-
exchangeDelete
public void exchangeDelete(AMQP.Exchange.Delete exchangeDelete) throws NotFoundException, PreconditionFailedException, AMQPException
-
queueBind
public void queueBind(AMQP.Queue.Bind queueBind) throws NotFoundException, SyntaxErrorException, ResourceLockedException, AMQPException
-
queueDeclare
public AMQP.Queue.DeclareOk queueDeclare(AMQP.Queue.Declare queueDeclare) throws NotFoundException, ResourceLockedException, AMQPException
-
queueDelete
public AMQP.Queue.DeleteOk queueDelete(AMQP.Queue.Delete queueDelete) throws NotFoundException, PreconditionFailedException, ResourceLockedException, AMQPException
-
cleanQueueContext
private void cleanQueueContext(int channelNumber, QueueShell queueShell)
-
queuePurge
public AMQP.Queue.PurgeOk queuePurge(AMQP.Queue.Purge queuePurge) throws NotFoundException, NotAllowedException, ResourceLockedException, SyntaxErrorException, AMQPException
-
queueUnbind
public void queueUnbind(AMQP.Queue.Unbind queueUnbind) throws NotFoundException, AMQPException
- Throws:
NotFoundExceptionAMQPException
-
txCommit
public void txCommit(int channelNumber) throws PreconditionFailedException, TransactionException
-
txRollback
public void txRollback(int channelNumber) throws PreconditionFailedException- Throws:
PreconditionFailedException
-
deliver
public boolean deliver(String consumerTag, int channelNumber, Queue queue, short serverId, long proxyId)
- Specified by:
deliverin interfaceDeliveryListener
-
send
public void send(AbstractMarshallingMethod method)
-
send
public void send(GetResponse response)
-
send
public void send(Deliver deliver, QueueShell queue)
-
send
public void send(Returned response)
-
stop
public void stop()
-
start
public void start()
-
getQueueInSize
public int getQueueInSize()
- Specified by:
getQueueInSizein interfaceProxyMBean
-
getQueueOutSize
public int getQueueOutSize()
- Specified by:
getQueueOutSizein interfaceProxyMBean
-
getExclusiveQueues
public Set<String> getExclusiveQueues()
- Specified by:
getExclusiveQueuesin interfaceProxyMBean
-
getOpenedChannels
public Integer[] getOpenedChannels()
- Specified by:
getOpenedChannelsin interfaceProxyMBean
-
-