Class RabbitMQChannelFactory
java.lang.Object
org.apache.commons.pool2.BaseObject
org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
edu.ucsb.nceas.metacat.index.queue.pool.RabbitMQChannelFactory
- All Implemented Interfaces:
org.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>
public class RabbitMQChannelFactory
extends org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
This factory is used to create the RabbitMQ channels in the channel pool.
- Author:
- Tao
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.rabbitmq.client.Channelcreate()voiddestroyObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) intGet the negotiated maximum channel number.Get the host name of the rabbitmq serviceintGet the port number of the rabbitmq servicebooleanvalidateObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel>wrap(com.rabbitmq.client.Channel channel) Methods inherited from class org.apache.commons.pool2.BasePooledObjectFactory
activateObject, makeObject, passivateObjectMethods inherited from class org.apache.commons.pool2.BaseObject
toString, toStringAppendFieldsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.pool2.PooledObjectFactory
destroyObject
-
Field Details
-
INDEX_QUEUE_NAME
- See Also:
-
EXCHANGE_NAME
- See Also:
-
INDEX_ROUTING_KEY
- See Also:
-
-
Constructor Details
-
RabbitMQChannelFactory
Constructor- Throws:
IOExceptionTimeoutException
-
-
Method Details
-
destroyObject
public void destroyObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) throws IOException, TimeoutException - Specified by:
destroyObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>- Overrides:
destroyObjectin classorg.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>- Throws:
IOExceptionTimeoutException
-
validateObject
public boolean validateObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) - Specified by:
validateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>- Overrides:
validateObjectin classorg.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
-
create
- Specified by:
createin classorg.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>- Throws:
IOExceptionTimeoutException
-
wrap
public org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> wrap(com.rabbitmq.client.Channel channel) - Specified by:
wrapin classorg.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
-
getChannelMax
Get the negotiated maximum channel number.- Returns:
- the maximum channel number permitted for this connection
- Throws:
IOExceptionTimeoutException
-
getRabbitMQhost
Get the host name of the rabbitmq service- Returns:
- the host name of the rabbitmq service
-
getRabbitMQport
public int getRabbitMQport()Get the port number of the rabbitmq service- Returns:
- the port number of the rabbitmq service
-