Package com.rabbitmq.stream.impl
Class Client
- java.lang.Object
-
- com.rabbitmq.stream.impl.Client
-
- All Implemented Interfaces:
AutoCloseable
public class Client extends Object implements AutoCloseable
This is low-level client API to communicate with the broker.It is not meant for public usage and can change at any time.
Users are encouraged to use the
Environment
,Producer
,Consumer
API, and their respective builders to interact with the broker.People wanting very fine control over their interaction with the broker can use
Client
but at their own risk.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Client.Broker
static interface
Client.ChunkListener
static class
Client.ClientParameters
static interface
Client.ConsumerUpdateListener
static interface
Client.CreditNotification
static interface
Client.MessageIgnoredListener
static interface
Client.MessageListener
static interface
Client.MetadataListener
static interface
Client.OutboundEntityMappingCallback
static interface
Client.PublishConfirmListener
static interface
Client.PublishErrorListener
static class
Client.QueryOffsetResponse
static class
Client.Response
static class
Client.ShutdownContext
static interface
Client.ShutdownListener
static class
Client.StreamMetadata
static class
Client.StreamParametersBuilder
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PORT
static int
DEFAULT_TLS_PORT
-
Constructor Summary
Constructors Constructor Description Client()
Client(Client.ClientParameters parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
brokerVersion()
void
close()
void
consumerUpdateResponse(int correlationId, short responseCode, OffsetSpecification offsetSpecification)
Client.Response
create(String stream)
Client.Response
create(String stream, Map<String,String> arguments)
void
credit(byte subscriptionId, int credit)
Client.Response
declarePublisher(byte publisherId, String publisherReference, String stream)
Client.Response
delete(String stream)
Client.Response
deletePublisher(byte publisherId)
boolean
filteringSupported()
boolean
isOpen()
SocketAddress
localAddress()
MessageBuilder
messageBuilder()
Map<String,Client.StreamMetadata>
metadata(String... streams)
List<String>
partitions(String superStream)
List<Long>
publish(byte publisherId, List<Message> messages)
List<Long>
publish(byte publisherId, List<Message> messages, Client.OutboundEntityMappingCallback mappingCallback)
List<Long>
publish(byte publisherId, List<Message> messages, Client.OutboundEntityMappingCallback mappingCallback, ToLongFunction<Object> publishSequenceFunction)
List<Long>
publish(byte publisherId, List<Message> messages, ToLongFunction<Object> publishSequenceFunction)
List<Long>
publishBatches(byte publisherId, List<MessageBatch> messageBatches)
List<Long>
publishBatches(byte publisherId, List<MessageBatch> messageBatches, Client.OutboundEntityMappingCallback mappingCallback)
List<Long>
publishBatches(byte publisherId, List<MessageBatch> messageBatches, Client.OutboundEntityMappingCallback mappingCallback, ToLongFunction<Object> publishSequenceFunction)
List<Long>
publishBatches(byte publisherId, List<MessageBatch> messageBatches, ToLongFunction<Object> publishSequenceFunction)
Client.QueryOffsetResponse
queryOffset(String reference, String stream)
long
queryPublisherSequence(String publisherReference, String stream)
SocketAddress
remoteAddress()
List<String>
route(String routingKey, String superStream)
void
storeOffset(String reference, String stream, long offset)
Client.Response
subscribe(byte subscriptionId, String stream, OffsetSpecification offsetSpecification, int credit)
Subscribe to receive messages from a stream.Client.Response
subscribe(byte subscriptionId, String stream, OffsetSpecification offsetSpecification, int initialCredits, Map<String,String> properties)
Subscribe to receive messages from a stream.String
toString()
Client.Response
unsubscribe(byte subscriptionId)
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
DEFAULT_TLS_PORT
public static final int DEFAULT_TLS_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Client
public Client()
-
Client
public Client(Client.ClientParameters parameters)
-
-
Method Detail
-
create
public Client.Response create(String stream)
-
create
public Client.Response create(String stream, Map<String,String> arguments)
-
delete
public Client.Response delete(String stream)
-
metadata
public Map<String,Client.StreamMetadata> metadata(String... streams)
-
declarePublisher
public Client.Response declarePublisher(byte publisherId, String publisherReference, String stream)
-
deletePublisher
public Client.Response deletePublisher(byte publisherId)
-
publish
public List<Long> publish(byte publisherId, List<Message> messages, ToLongFunction<Object> publishSequenceFunction)
-
publish
public List<Long> publish(byte publisherId, List<Message> messages, Client.OutboundEntityMappingCallback mappingCallback)
-
publish
public List<Long> publish(byte publisherId, List<Message> messages, Client.OutboundEntityMappingCallback mappingCallback, ToLongFunction<Object> publishSequenceFunction)
-
publishBatches
public List<Long> publishBatches(byte publisherId, List<MessageBatch> messageBatches)
-
publishBatches
public List<Long> publishBatches(byte publisherId, List<MessageBatch> messageBatches, ToLongFunction<Object> publishSequenceFunction)
-
publishBatches
public List<Long> publishBatches(byte publisherId, List<MessageBatch> messageBatches, Client.OutboundEntityMappingCallback mappingCallback)
-
publishBatches
public List<Long> publishBatches(byte publisherId, List<MessageBatch> messageBatches, Client.OutboundEntityMappingCallback mappingCallback, ToLongFunction<Object> publishSequenceFunction)
-
messageBuilder
public MessageBuilder messageBuilder()
-
credit
public void credit(byte subscriptionId, int credit)
-
subscribe
public Client.Response subscribe(byte subscriptionId, String stream, OffsetSpecification offsetSpecification, int credit)
Subscribe to receive messages from a stream.Note the offset is an unsigned long. Longs are signed in Java, but unsigned longs can be used as long as some care is taken for some operations. See the
unsigned*
static methods inLong
.- Parameters:
subscriptionId
- identifier to correlate inbound messages to this subscriptionstream
- the stream to consume fromoffsetSpecification
- the specification of the offset to consume fromcredit
- the initial number of credits- Returns:
- the subscription confirmation
-
subscribe
public Client.Response subscribe(byte subscriptionId, String stream, OffsetSpecification offsetSpecification, int initialCredits, Map<String,String> properties)
Subscribe to receive messages from a stream.Note the offset is an unsigned long. Longs are signed in Java, but unsigned longs can be used as long as some care is taken for some operations. See the
unsigned*
static methods inLong
.- Parameters:
subscriptionId
- identifier to correlate inbound messages to this subscriptionstream
- the stream to consume fromoffsetSpecification
- the specification of the offset to consume frominitialCredits
- the initial number of creditsproperties
- some optional properties to describe the subscription- Returns:
- the subscription confirmation
-
queryOffset
public Client.QueryOffsetResponse queryOffset(String reference, String stream)
-
queryPublisherSequence
public long queryPublisherSequence(String publisherReference, String stream)
-
unsubscribe
public Client.Response unsubscribe(byte subscriptionId)
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
isOpen
public boolean isOpen()
-
filteringSupported
public boolean filteringSupported()
-
consumerUpdateResponse
public void consumerUpdateResponse(int correlationId, short responseCode, OffsetSpecification offsetSpecification)
-
localAddress
public SocketAddress localAddress()
-
remoteAddress
public SocketAddress remoteAddress()
-
brokerVersion
public String brokerVersion()
-
-