@UriEndpoint(firstVersion="2.12.0",
scheme="rabbitmq",
title="RabbitMQ",
syntax="rabbitmq:exchangeName",
category=MESSAGING)
public class RabbitMQEndpoint
extends org.apache.camel.support.DefaultEndpoint
implements org.apache.camel.AsyncEndpoint
Modifier and Type | Field and Description |
---|---|
static String |
SERIALIZE_HEADER |
Constructor and Description |
---|
RabbitMQEndpoint() |
RabbitMQEndpoint(String endpointUri,
RabbitMQComponent component) |
RabbitMQEndpoint(String endpointUri,
RabbitMQComponent component,
com.rabbitmq.client.ConnectionFactory connectionFactory) |
Modifier and Type | Method and Description |
---|---|
com.rabbitmq.client.Connection |
connect(ExecutorService executor) |
org.apache.camel.Consumer |
createConsumer(org.apache.camel.Processor processor) |
protected ExecutorService |
createExecutor() |
org.apache.camel.Producer |
createProducer() |
org.apache.camel.Exchange |
createRabbitExchange(com.rabbitmq.client.Envelope envelope,
com.rabbitmq.client.AMQP.BasicProperties properties,
byte[] body) |
void |
declareExchangeAndQueue(com.rabbitmq.client.Channel channel)
If needed, declare Exchange, declare Queue and bind them with Routing Key
|
String |
getAddresses() |
Map<String,Object> |
getArgs() |
Boolean |
getAutomaticRecoveryEnabled() |
Map<String,Object> |
getBindingArgs() |
int |
getChannelPoolMaxSize()
Get maximum number of opened channel in pool
|
long |
getChannelPoolMaxWait() |
Map<String,Object> |
getClientProperties() |
int |
getConcurrentConsumers() |
com.rabbitmq.client.ConnectionFactory |
getConnectionFactory() |
com.rabbitmq.client.ExceptionHandler |
getConnectionFactoryExceptionHandler() |
int |
getConnectionTimeout() |
String |
getConsumerTag() |
String |
getDeadLetterExchange() |
String |
getDeadLetterExchangeType() |
String |
getDeadLetterQueue() |
String |
getDeadLetterRoutingKey() |
Map<String,Object> |
getExchangeArgs() |
String |
getExchangeName() |
String |
getExchangeType() |
String |
getHostname() |
protected RabbitMQMessageConverter |
getMessageConverter()
Gets the message converter to convert between rabbit and camel
|
Integer |
getNetworkRecoveryInterval() |
String |
getPassword() |
int |
getPortNumber() |
int |
getPrefetchCount() |
int |
getPrefetchSize() |
long |
getPublisherAcknowledgementsTimeout()
The amount of time in milliseconds to wait for a basic.ack response from
RabbitMQ server
|
String |
getQueue() |
Map<String,Object> |
getQueueArgs() |
String |
getReplyTo()
Gets the Queue to reply to if you dont want to use temporary reply queues
|
String |
getReplyToType()
Get replyToType for inOut exchange
|
int |
getRequestedChannelMax() |
int |
getRequestedFrameMax() |
int |
getRequestedHeartbeat() |
long |
getRequestTimeout() |
long |
getRequestTimeoutCheckerInterval() |
String |
getRoutingKey() |
String |
getSslProtocol() |
int |
getThreadPoolSize() |
Boolean |
getTopologyRecoveryEnabled() |
TrustManager |
getTrustManager() |
String |
getUsername() |
String |
getVhost() |
boolean |
isAllowCustomHeaders() |
boolean |
isAllowMessageBodySerialization() |
boolean |
isAllowNullHeaders()
Allow pass null values to header
|
boolean |
isAutoAck() |
boolean |
isAutoDelete() |
boolean |
isBridgeEndpoint() |
boolean |
isDeclare() |
boolean |
isDurable() |
boolean |
isExclusive() |
boolean |
isExclusiveConsumer() |
boolean |
isGuaranteedDeliveries()
When true, an exception will be thrown when the message cannot be
delivered (basic.return) and the message is marked as mandatory.
|
boolean |
isImmediate() |
boolean |
isMandatory() |
boolean |
isPassive() |
boolean |
isPrefetchEnabled() |
boolean |
isPrefetchGlobal() |
boolean |
isPublisherAcknowledgements()
When true, the message will be published with
publisher
acknowledgements turned on
|
boolean |
isSkipExchangeDeclare() |
boolean |
isSkipQueueBind()
If true the queue will not be bound to the exchange after declaring it
|
boolean |
isSkipQueueDeclare() |
boolean |
isTransferException() |
boolean |
isUseMessageIDAsCorrelationID()
Get useMessageIDAsCorrelationID for inOut exchange
|
com.rabbitmq.client.Address[] |
parseAddresses() |
void |
publishExchangeToChannel(org.apache.camel.Exchange camelExchange,
com.rabbitmq.client.Channel channel,
String routingKey)
Sends the body that is on the exchange
|
void |
setAddresses(String addresses)
If this option is set, camel-rabbitmq will try to create connection based
on the setting of option addresses.
|
void |
setAllowCustomHeaders(boolean allowCustomHeaders)
Allow pass custom values to header
|
void |
setAllowMessageBodySerialization(boolean allowMessageBodySerialization)
Whether to allow Java serialization of the message body or not.
|
void |
setAllowNullHeaders(boolean allowNullHeaders) |
void |
setArgs(Map<String,Object> args)
Specify arguments for configuring the different RabbitMQ concepts, a
different prefix is required for each:
Exchange: arg.exchange.
Queue: arg.queue.
Binding: arg.binding.
For example to declare a queue with message ttl argument:
http://localhost:5672/exchange/queue?args=arg.queue.x-message-ttl=60000
|
void |
setAutoAck(boolean autoAck)
If messages should be auto acknowledged
|
void |
setAutoDelete(boolean autoDelete)
If it is true, the exchange will be deleted when it is no longer in use
|
void |
setAutomaticRecoveryEnabled(Boolean automaticRecoveryEnabled)
Enables connection automatic recovery (uses connection implementation
that performs automatic recovery when existing connection has failures)
|
void |
setBridgeEndpoint(boolean bridgeEndpoint)
If the bridgeEndpoint is true, the producer will ignore the message
header of "rabbitmq.EXCHANGE_NAME" and "rabbitmq.ROUTING_KEY"
|
void |
setChannelPoolMaxSize(int channelPoolMaxSize) |
void |
setChannelPoolMaxWait(long channelPoolMaxWait)
Set the maximum number of milliseconds to wait for a channel from the
pool
|
void |
setClientProperties(Map<String,Object> clientProperties)
Connection client properties (client info used in negotiating with the
server)
|
void |
setConcurrentConsumers(int concurrentConsumers)
Number of concurrent consumers when consuming from broker.
|
void |
setConnectionFactory(com.rabbitmq.client.ConnectionFactory connectionFactory)
To use a custom RabbitMQ connection factory.
|
void |
setConnectionFactoryExceptionHandler(com.rabbitmq.client.ExceptionHandler connectionFactoryExceptionHandler)
Custom rabbitmq ExceptionHandler for ConnectionFactory
|
void |
setConnectionTimeout(int connectionTimeout)
Connection timeout
|
void |
setConsumerTag(String consumerTag)
Specify a client-generated consumer tag to establish context when
invoking the consume operation
|
void |
setDeadLetterExchange(String deadLetterExchange)
The name of the dead letter exchange
|
void |
setDeadLetterExchangeType(String deadLetterExchangeType)
The type of the dead letter exchange
|
void |
setDeadLetterQueue(String deadLetterQueue)
The name of the dead letter queue
|
void |
setDeadLetterRoutingKey(String deadLetterRoutingKey)
The routing key for the dead letter exchange
|
void |
setDeclare(boolean declare)
If the option is true, camel declare the exchange and queue name and bind
them together.
|
void |
setDurable(boolean durable)
If we are declaring a durable exchange (the exchange will survive a
server restart)
|
void |
setExchangeName(String exchangeName)
The exchange name determines the exchange to which the produced
messages will be sent to.
|
void |
setExchangeType(String exchangeType)
The exchange type such as direct or topic.
|
void |
setExclusive(boolean exclusive)
Exclusive queues may only be accessed by the current connection, and are
deleted when that connection closes.
|
void |
setExclusiveConsumer(boolean exclusiveConsumer)
Request exclusive access to the queue (meaning only this consumer can
access the queue).
|
void |
setGuaranteedDeliveries(boolean guaranteedDeliveries) |
void |
setHostname(String hostname)
The hostname of the running rabbitmq instance or cluster.
|
void |
setImmediate(boolean immediate)
This flag tells the server how to react if the message cannot be routed
to a queue consumer immediately.
|
void |
setMandatory(boolean mandatory)
This flag tells the server how to react if the message cannot be routed
to a queue.
|
void |
setNetworkRecoveryInterval(Integer networkRecoveryInterval)
Network recovery interval in milliseconds (interval used when recovering
from network failure)
|
void |
setPassive(boolean passive)
Passive queues depend on the queue already to be available at RabbitMQ.
|
void |
setPassword(String password)
Password for authenticated access
|
void |
setPortNumber(int portNumber)
Port number for the host with the running rabbitmq instance or cluster.
|
void |
setPrefetchCount(int prefetchCount)
The maximum number of messages that the server will deliver, 0 if
unlimited.
|
void |
setPrefetchEnabled(boolean prefetchEnabled)
Enables the quality of service on the RabbitMQConsumer side.
|
void |
setPrefetchGlobal(boolean prefetchGlobal)
If the settings should be applied to the entire channel rather than each
consumer You need to specify the option of prefetchSize, prefetchCount,
prefetchGlobal at the same time
|
void |
setPrefetchSize(int prefetchSize)
The maximum amount of content (measured in octets) that the server will
deliver, 0 if unlimited.
|
void |
setPublisherAcknowledgements(boolean publisherAcknowledgements) |
void |
setPublisherAcknowledgementsTimeout(long publisherAcknowledgementsTimeout) |
void |
setQueue(String queue)
The queue to receive messages from
|
void |
setRequestedChannelMax(int requestedChannelMax)
Connection requested channel max (max number of channels offered)
|
void |
setRequestedFrameMax(int requestedFrameMax)
Connection requested frame max (max size of frame offered)
|
void |
setRequestedHeartbeat(int requestedHeartbeat)
Connection requested heartbeat (heart-beat in seconds offered)
|
void |
setRequestTimeout(long requestTimeout)
Set timeout for waiting for a reply when using the InOut Exchange Pattern
(in milliseconds)
|
void |
setRequestTimeoutCheckerInterval(long requestTimeoutCheckerInterval)
Set requestTimeoutCheckerInterval for inOut exchange
|
void |
setRoutingKey(String routingKey)
The routing key to use when binding a consumer queue to the exchange.
|
void |
setSkipExchangeDeclare(boolean skipExchangeDeclare)
This can be used if we need to declare the queue but not the exchange
|
void |
setSkipQueueBind(boolean skipQueueBind) |
void |
setSkipQueueDeclare(boolean skipQueueDeclare)
If true the producer will not declare and bind a queue.
|
void |
setSslProtocol(String sslProtocol)
Enables SSL on connection, accepted value are `true`, `TLS` and 'SSLv3`
|
void |
setThreadPoolSize(int threadPoolSize)
The consumer uses a Thread Pool Executor with a fixed number of threads.
|
void |
setTopologyRecoveryEnabled(Boolean topologyRecoveryEnabled)
Enables connection topology recovery (should topology recovery be
performed?)
|
void |
setTransferException(boolean transferException)
When true and an inOut Exchange failed on the consumer side send the
caused Exception back in the response
|
void |
setTrustManager(TrustManager trustManager)
Configure SSL trust manager, SSL should be enabled for this option to be
effective
|
void |
setUsername(String username)
Username in case of authenticated access
|
void |
setVhost(String vhost)
The vhost for the channel
|
configureConsumer, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, doStart, doStop, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isBasicPropertyBinding, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isSingleton, isSynchronous, setBasicPropertyBinding, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
configureProperties, createAsyncProducer, createExchange, createExchange, createPollingConsumer, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, isLenientProperties, isSingletonProducer, setCamelContext
public static final String SERIALIZE_HEADER
public RabbitMQEndpoint()
public RabbitMQEndpoint(String endpointUri, RabbitMQComponent component)
public RabbitMQEndpoint(String endpointUri, RabbitMQComponent component, com.rabbitmq.client.ConnectionFactory connectionFactory)
public org.apache.camel.Exchange createRabbitExchange(com.rabbitmq.client.Envelope envelope, com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body)
protected RabbitMQMessageConverter getMessageConverter()
public void publishExchangeToChannel(org.apache.camel.Exchange camelExchange, com.rabbitmq.client.Channel channel, String routingKey) throws IOException
IOException
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
createConsumer
in interface org.apache.camel.Endpoint
Exception
public com.rabbitmq.client.Connection connect(ExecutorService executor) throws IOException, TimeoutException
IOException
TimeoutException
public void declareExchangeAndQueue(com.rabbitmq.client.Channel channel) throws IOException
IOException
public org.apache.camel.Producer createProducer() throws Exception
createProducer
in interface org.apache.camel.Endpoint
Exception
protected ExecutorService createExecutor()
public String getUsername()
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public String getVhost()
public void setVhost(String vhost)
public String getHostname()
public void setHostname(String hostname)
public int getThreadPoolSize()
public void setThreadPoolSize(int threadPoolSize)
public int getPortNumber()
public void setPortNumber(int portNumber)
public boolean isAutoAck()
public void setAutoAck(boolean autoAck)
public boolean isAutoDelete()
public void setAutoDelete(boolean autoDelete)
public boolean isDurable()
public void setDurable(boolean durable)
public String getQueue()
public void setQueue(String queue)
public String getExchangeName()
public void setExchangeName(String exchangeName)
public String getExchangeType()
public void setExchangeType(String exchangeType)
public String getRoutingKey()
public void setRoutingKey(String routingKey)
public void setSkipQueueDeclare(boolean skipQueueDeclare)
public boolean isSkipQueueDeclare()
public boolean isSkipQueueBind()
public void setSkipQueueBind(boolean skipQueueBind)
public void setSkipExchangeDeclare(boolean skipExchangeDeclare)
public boolean isSkipExchangeDeclare()
public void setBridgeEndpoint(boolean bridgeEndpoint)
public boolean isBridgeEndpoint()
public void setAddresses(String addresses)
public String getAddresses()
public com.rabbitmq.client.Address[] parseAddresses()
public int getConnectionTimeout()
public void setConnectionTimeout(int connectionTimeout)
public int getRequestedChannelMax()
public void setRequestedChannelMax(int requestedChannelMax)
public int getRequestedFrameMax()
public void setRequestedFrameMax(int requestedFrameMax)
public int getRequestedHeartbeat()
public void setRequestedHeartbeat(int requestedHeartbeat)
public String getSslProtocol()
public void setSslProtocol(String sslProtocol)
public com.rabbitmq.client.ConnectionFactory getConnectionFactory()
public void setConnectionFactory(com.rabbitmq.client.ConnectionFactory connectionFactory)
public TrustManager getTrustManager()
public void setTrustManager(TrustManager trustManager)
public void setClientProperties(Map<String,Object> clientProperties)
public Boolean getAutomaticRecoveryEnabled()
public void setAutomaticRecoveryEnabled(Boolean automaticRecoveryEnabled)
public boolean isAllowMessageBodySerialization()
public void setAllowMessageBodySerialization(boolean allowMessageBodySerialization)
public Integer getNetworkRecoveryInterval()
public void setNetworkRecoveryInterval(Integer networkRecoveryInterval)
public Boolean getTopologyRecoveryEnabled()
public void setTopologyRecoveryEnabled(Boolean topologyRecoveryEnabled)
public boolean isPrefetchEnabled()
public void setPrefetchEnabled(boolean prefetchEnabled)
public void setPrefetchSize(int prefetchSize)
public int getPrefetchSize()
public void setPrefetchCount(int prefetchCount)
public int getPrefetchCount()
public void setPrefetchGlobal(boolean prefetchGlobal)
public boolean isPrefetchGlobal()
public int getConcurrentConsumers()
public void setConcurrentConsumers(int concurrentConsumers)
public boolean isDeclare()
public void setDeclare(boolean declare)
public String getDeadLetterExchange()
public void setDeadLetterExchange(String deadLetterExchange)
public String getDeadLetterQueue()
public void setDeadLetterQueue(String deadLetterQueue)
public String getDeadLetterRoutingKey()
public void setDeadLetterRoutingKey(String deadLetterRoutingKey)
public String getDeadLetterExchangeType()
public void setDeadLetterExchangeType(String deadLetterExchangeType)
public int getChannelPoolMaxSize()
public void setChannelPoolMaxSize(int channelPoolMaxSize)
public long getChannelPoolMaxWait()
public void setChannelPoolMaxWait(long channelPoolMaxWait)
public boolean isMandatory()
public void setMandatory(boolean mandatory)
public boolean isImmediate()
public void setImmediate(boolean immediate)
public void setArgs(Map<String,Object> args)
public void setRequestTimeout(long requestTimeout)
public long getRequestTimeout()
public void setRequestTimeoutCheckerInterval(long requestTimeoutCheckerInterval)
public long getRequestTimeoutCheckerInterval()
public boolean isUseMessageIDAsCorrelationID()
public void setTransferException(boolean transferException)
public boolean isTransferException()
public boolean isPublisherAcknowledgements()
public void setPublisherAcknowledgements(boolean publisherAcknowledgements)
public long getPublisherAcknowledgementsTimeout()
public void setPublisherAcknowledgementsTimeout(long publisherAcknowledgementsTimeout)
public boolean isGuaranteedDeliveries()
public void setGuaranteedDeliveries(boolean guaranteedDeliveries)
public String getReplyToType()
public String getReplyTo()
public boolean isExclusive()
public void setExclusive(boolean exclusive)
public boolean isExclusiveConsumer()
public void setExclusiveConsumer(boolean exclusiveConsumer)
public boolean isAllowNullHeaders()
public void setAllowNullHeaders(boolean allowNullHeaders)
public boolean isPassive()
public void setPassive(boolean passive)
public String getConsumerTag()
public void setConsumerTag(String consumerTag)
public boolean isAllowCustomHeaders()
public void setAllowCustomHeaders(boolean allowCustomHeaders)
public com.rabbitmq.client.ExceptionHandler getConnectionFactoryExceptionHandler()
public void setConnectionFactoryExceptionHandler(com.rabbitmq.client.ExceptionHandler connectionFactoryExceptionHandler)
Apache Camel