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.Channel
create()
void
destroyObject
(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) int
Get the negotiated maximum channel number.Get the host name of the rabbitmq serviceint
Get the port number of the rabbitmq serviceboolean
validateObject
(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, passivateObject
Methods inherited from class org.apache.commons.pool2.BaseObject
toString, toStringAppendFields
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
IOException
TimeoutException
-
-
Method Details
-
destroyObject
public void destroyObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) throws IOException, TimeoutException - Specified by:
destroyObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>
- Overrides:
destroyObject
in classorg.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
- Throws:
IOException
TimeoutException
-
validateObject
public boolean validateObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) - Specified by:
validateObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>
- Overrides:
validateObject
in classorg.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
-
create
- Specified by:
create
in classorg.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
- Throws:
IOException
TimeoutException
-
wrap
public org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> wrap(com.rabbitmq.client.Channel channel) - Specified by:
wrap
in 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:
IOException
TimeoutException
-
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
-