TypedMessageBuilder
as returned by Producer.newMessage()
to create a new
message builder.@Deprecated public interface MessageBuilder<T>
Modifier and Type | Method and Description |
---|---|
Message<T> |
build()
Deprecated.
Finalize the immutable message
|
static MessageBuilder<byte[]> |
create()
Deprecated.
|
static <T> MessageBuilder<T> |
create(Schema<T> schema)
Deprecated.
Create a new message builder instance.
|
MessageBuilder<T> |
disableReplication()
Deprecated.
Disable replication for this message.
|
MessageBuilder<T> |
setContent(byte[] data)
Deprecated.
Set the content of the message
|
MessageBuilder<T> |
setContent(byte[] data,
int offset,
int length)
Deprecated.
Set the content of the message
|
MessageBuilder<T> |
setContent(ByteBuffer buf)
Deprecated.
Set the content of the message
|
MessageBuilder<T> |
setEventTime(long timestamp)
Deprecated.
Set the event time for a given message.
|
MessageBuilder<T> |
setKey(String key)
Deprecated.
Sets the key of the message for routing policy
|
MessageBuilder<T> |
setProperties(Map<String,String> properties)
Deprecated.
Add all the properties in the provided map
|
MessageBuilder<T> |
setProperty(String name,
String value)
Deprecated.
Sets a new property on a message.
|
MessageBuilder<T> |
setReplicationClusters(List<String> clusters)
Deprecated.
Override the replication clusters for this message.
|
MessageBuilder<T> |
setSequenceId(long sequenceId)
Deprecated.
Specify a custom sequence id for the message being published.
|
MessageBuilder<T> |
setValue(T value)
Deprecated.
Set a domain object on the message
|
static <T> MessageBuilder<T> create(Schema<T> schema)
A message builder is suitable for creating one single message
static MessageBuilder<byte[]> create()
MessageBuilder<T> setValue(T value)
value
- the domain objectMessageBuilder<T> setContent(byte[] data)
data
- array containing the payloadMessageBuilder<T> setContent(byte[] data, int offset, int length)
data
- array containing the payloadoffset
- offset into the data arraylength
- length of the payload starting from the above offsetMessageBuilder<T> setContent(ByteBuffer buf)
buf
- a ByteBuffer
with the payload of the messageMessageBuilder<T> setProperty(String name, String value)
name
- the name of the propertyvalue
- the associated valueMessageBuilder<T> setProperties(Map<String,String> properties)
MessageBuilder<T> setKey(String key)
key
- MessageBuilder<T> setEventTime(long timestamp)
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.
MessageBuilder<T> setSequenceId(long sequenceId)
The sequence id can be used for deduplication purposes and it needs to follow these rules:
sequenceId >= 0
sequenceId(N+1) > sequenceId(N)
sequenceId
could represent an offset or a cumulative size.
sequenceId
- the sequence id to assign to the current messageMessageBuilder<T> setReplicationClusters(List<String> clusters)
clusters
- MessageBuilder<T> disableReplication()
Copyright © 2017–2018 Apache Software Foundation. All rights reserved.