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,ConsumerAPI, and their respective builders to interact with the broker.People wanting very fine control over their interaction with the broker can use
Clientbut at their own risk.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClient.Brokerstatic interfaceClient.ChunkListenerstatic classClient.ClientParametersstatic interfaceClient.ConsumerUpdateListenerstatic interfaceClient.CreditNotificationstatic interfaceClient.MessageIgnoredListenerstatic interfaceClient.MessageListenerstatic interfaceClient.MetadataListenerstatic interfaceClient.OutboundEntityMappingCallbackstatic interfaceClient.PublishConfirmListenerstatic interfaceClient.PublishErrorListenerstatic classClient.QueryOffsetResponsestatic classClient.Responsestatic classClient.ShutdownContextstatic interfaceClient.ShutdownListenerstatic classClient.StreamMetadatastatic classClient.StreamParametersBuilder
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_PORTstatic intDEFAULT_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 StringbrokerVersion()voidclose()voidconsumerUpdateResponse(int correlationId, short responseCode, OffsetSpecification offsetSpecification)Client.Responsecreate(String stream)Client.Responsecreate(String stream, Map<String,String> arguments)voidcredit(byte subscriptionId, int credit)Client.ResponsedeclarePublisher(byte publisherId, String publisherReference, String stream)Client.Responsedelete(String stream)Client.ResponsedeletePublisher(byte publisherId)booleanfilteringSupported()booleanisOpen()SocketAddresslocalAddress()MessageBuildermessageBuilder()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.QueryOffsetResponsequeryOffset(String reference, String stream)longqueryPublisherSequence(String publisherReference, String stream)SocketAddressremoteAddress()List<String>route(String routingKey, String superStream)voidstoreOffset(String reference, String stream, long offset)Client.Responsesubscribe(byte subscriptionId, String stream, OffsetSpecification offsetSpecification, int credit)Subscribe to receive messages from a stream.Client.Responsesubscribe(byte subscriptionId, String stream, OffsetSpecification offsetSpecification, int initialCredits, Map<String,String> properties)Subscribe to receive messages from a stream.StringtoString()Client.Responseunsubscribe(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:
closein 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()
-
-