Package org.apache.pulsar.client.api
Interface MessageBuilder
- All Known Implementing Classes:
MessageBuilderImpl
Deprecated.
Message builder factory. Use this class to create messages to be send to the Pulsar producer
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pulsar.client.api.Message<byte[]>build()Deprecated.Finalize the immutable message.static MessageBuildercreate()Deprecated.Deprecated.Disable replication for this message.setContent(byte[] data) Deprecated.Set the content of the message.setContent(byte[] data, int offset, int length) Deprecated.Set the content of the message.setContent(ByteBuffer buf) Deprecated.Set the content of the message.setEventTime(long timestamp) Deprecated.Set the event time for a given message.Deprecated.Sets the key of the message for routing policy.setProperties(Map<String, String> properties) Deprecated.Add all the properties in the provided map.setProperty(String name, String value) Deprecated.Sets a new property on a message.setReplicationClusters(List<String> clusters) Deprecated.Override the replication clusters for this message.setSequenceId(long sequenceId) Deprecated.Specify a custom sequence id for the message being published.
-
Method Details
-
create
Deprecated. -
build
org.apache.pulsar.client.api.Message<byte[]> build()Deprecated.Finalize the immutable message.- Returns:
- a
Messageready to be sent through aProducer
-
setContent
Deprecated.Set the content of the message.- Parameters:
data- array containing the payload
-
setContent
Deprecated.Set the content of the message.- Parameters:
data- array containing the payloadoffset- offset into the data arraylength- length of the payload starting from the above offset
-
setContent
Deprecated.Set the content of the message.- Parameters:
buf- aByteBufferwith the payload of the message
-
setProperty
Deprecated.Sets a new property on a message.- Parameters:
name- the name of the propertyvalue- the associated value
-
setProperties
Deprecated.Add all the properties in the provided map. -
setKey
Deprecated.Sets the key of the message for routing policy.- Parameters:
key-
-
setEventTime
Deprecated.Set the event time for a given message.Applications can retrieve the event time by calling
Message.getEventTime().Note: currently pulsar doesn't support event-time based index. so the subscribers can't seek the messages by event time.
- Since:
- 1.20.0
-
setSequenceId
Deprecated.Specify a custom sequence id for the message being published.The sequence id can be used for deduplication purposes and it needs to follow these rules:
sequenceId >= 0- Sequence id for a message needs to be greater than sequence id for earlier messages:
sequenceId(N+1) > sequenceId(N) - It's not necessary for sequence ids to be consecutive. There can be holes between messages. Eg. the
sequenceIdcould represent an offset or a cumulative size.
- Parameters:
sequenceId- the sequence id to assign to the current message- Since:
- 1.20.0
-
setReplicationClusters
Deprecated.Override the replication clusters for this message.- Parameters:
clusters-
-
disableReplication
MessageBuilder disableReplication()Deprecated.Disable replication for this message.
-
TypedMessageBuilderas returned byProducer#newMessage()to create a new message builder.