@Internal @EachBean(value=ChannelPool.class) public class RxJavaReactivePublisher extends Object implements ReactivePublisher
Completable
.
This is an internal API and may change at any timeConstructor and Description |
---|
RxJavaReactivePublisher(ChannelPool channelPool,
RabbitConnectionFactoryConfig config)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected io.reactivex.disposables.Disposable |
createConsumer(com.rabbitmq.client.Channel channel,
RabbitPublishState publishState,
String correlationId,
io.reactivex.SingleEmitter<RabbitConsumerState> emitter)
Listens for ack/nack from the broker.
|
protected io.reactivex.disposables.Disposable |
createListener(com.rabbitmq.client.Channel channel,
io.reactivex.CompletableEmitter emitter,
RabbitPublishState publishState)
Listens for ack/nack from the broker.
|
protected io.reactivex.Single<com.rabbitmq.client.Channel> |
getChannel()
Creates a
Single from a channel, emitting an error
if the channel could not be retrieved. |
protected io.reactivex.Single<com.rabbitmq.client.Channel> |
initializePublish(com.rabbitmq.client.Channel channel)
Initializes the channel to allow publisher acknowledgements.
|
io.reactivex.Flowable<Void> |
publish(RabbitPublishState publishState)
Publish the message with the provided arguments and return
a reactive type that completes successfully when the message
is published.
|
io.reactivex.Flowable<Void> |
publishAndConfirm(RabbitPublishState publishState)
Publish the message with the provided arguments and return
a reactive type that completes successfully when the broker
acknowledged the message.
|
io.reactivex.Flowable<RabbitConsumerState> |
publishAndReply(RabbitPublishState publishState)
Publish the message with the provided arguments and return
a reactive type that completes successfully when the reply
is received from the reply to queue.
|
protected io.reactivex.Completable |
publishInternal(com.rabbitmq.client.Channel channel,
RabbitPublishState publishState)
Publishes the message to the channel.
|
protected io.reactivex.Completable |
publishInternalNoConfirm(com.rabbitmq.client.Channel channel,
RabbitPublishState publishState)
Publishes the message to the channel.
|
protected io.reactivex.Single<RabbitConsumerState> |
publishRpcInternal(com.rabbitmq.client.Channel channel,
RabbitPublishState publishState)
Publishes the message to the channel.
|
protected void |
returnChannel(com.rabbitmq.client.Channel channel)
Removes confirm listeners from the channel and returns the
channel to the pool.
|
public RxJavaReactivePublisher(@Parameter ChannelPool channelPool, @Parameter RabbitConnectionFactoryConfig config)
channelPool
- The channel pool to retrieve channelsconfig
- Any configuration used in building the publisherspublic io.reactivex.Flowable<Void> publishAndConfirm(RabbitPublishState publishState)
ReactivePublisher
publishAndConfirm
in interface ReactivePublisher
publishState
- The RabbitMQ publishing datapublic io.reactivex.Flowable<Void> publish(RabbitPublishState publishState)
ReactivePublisher
publish
in interface ReactivePublisher
publishState
- The RabbitMQ publishing datapublic io.reactivex.Flowable<RabbitConsumerState> publishAndReply(RabbitPublishState publishState)
ReactivePublisher
publishAndReply
in interface ReactivePublisher
publishState
- The RabbitMQ publishing dataprotected io.reactivex.Single<com.rabbitmq.client.Channel> getChannel()
Single
from a channel, emitting an error
if the channel could not be retrieved.Single
that emits the channel on successprotected io.reactivex.Completable publishInternal(com.rabbitmq.client.Channel channel, RabbitPublishState publishState)
Completable
returned from this
method should ensure the ConfirmListener
is added to the channel prior
to publishing and the ConfirmListener
is removed from the channel after
the publish has been acknowledged.channel
- The channel to publish the message topublishState
- The publishing stateChannel.basicPublish(String, String, AMQP.BasicProperties, byte[])
protected io.reactivex.Single<RabbitConsumerState> publishRpcInternal(com.rabbitmq.client.Channel channel, RabbitPublishState publishState)
Completable
returned from this
method should ensure the ConfirmListener
is added to the channel prior
to publishing and the ConfirmListener
is removed from the channel after
the publish has been acknowledged.channel
- The channel to publish the message topublishState
- The publishing stateChannel.basicPublish(String, String, AMQP.BasicProperties, byte[])
protected io.reactivex.Completable publishInternalNoConfirm(com.rabbitmq.client.Channel channel, RabbitPublishState publishState)
Completable
returned from this
method should ensure the ConfirmListener
is added to the channel prior
to publishing and the ConfirmListener
is removed from the channel after
the publish has been acknowledged.channel
- The channel to publish the message topublishState
- The publishing stateChannel.basicPublish(String, String, AMQP.BasicProperties, byte[])
protected io.reactivex.Single<com.rabbitmq.client.Channel> initializePublish(com.rabbitmq.client.Channel channel)
channel
- The channel to enable acknowledgements.Single
that will complete according to the
success of the operation.protected void returnChannel(com.rabbitmq.client.Channel channel)
channel
- The channel to clean and returnprotected io.reactivex.disposables.Disposable createListener(com.rabbitmq.client.Channel channel, io.reactivex.CompletableEmitter emitter, RabbitPublishState publishState)
channel
- The channel to listen for confirmsemitter
- The emitter to send the eventpublishState
- The publishing stateprotected io.reactivex.disposables.Disposable createConsumer(com.rabbitmq.client.Channel channel, RabbitPublishState publishState, String correlationId, io.reactivex.SingleEmitter<RabbitConsumerState> emitter) throws IOException
channel
- The channel to listen for confirmspublishState
- The publish statecorrelationId
- The correlation idemitter
- The emitter to send the responseIOException
- If an error occurred subscribing