
io.lettuce.core.StreamMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lettuce-core Show documentation
Show all versions of lettuce-core Show documentation
Advanced and thread-safe Java Redis client for synchronous, asynchronous, and
reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs
and much more.
The newest version!
package io.lettuce.core;
import java.util.Map;
import java.util.Objects;
/**
* A stream message and its id.
*
* @author Mark Paluch
* @since 5.1
*/
public class StreamMessage {
private final K stream;
private final String id;
private final Map body;
/**
* Create a new {@link StreamMessage}.
*
* @param stream the stream.
* @param id the message id.
* @param body map containing the message body.
*/
public StreamMessage(K stream, String id, Map body) {
this.stream = stream;
this.id = id;
this.body = body;
}
public K getStream() {
return stream;
}
public String getId() {
return id;
}
/**
* @return the message body. Can be {@code null} for commands that do not return the message body.
*/
public Map getBody() {
return body;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof StreamMessage))
return false;
StreamMessage, ?> that = (StreamMessage, ?>) o;
return Objects.equals(stream, that.stream) && Objects.equals(id, that.id) && Objects.equals(body, that.body);
}
@Override
public int hashCode() {
return Objects.hash(stream, id, body);
}
@Override
public String toString() {
return String.format("StreamMessage[%s:%s]%s", stream, id, body);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy