ProtocolConversion¶
-
public final class
ProtocolConversion
¶ A utility class to converter between protocol buffers based classes and our user level types.
- Author
jwienke
Methods¶
createEventIdBuilder¶
-
public static EventId.Builder
createEventIdBuilder
(rsb.EventId id)¶ Creates a build for the serialization of an
rsb.EventId
, filled with the contents of the given id.- Parameters
id – the id to serialize
- Returns
the builder
fillNotificationHeader¶
-
public static void
fillNotificationHeader
(Builder notificationBuilder, Event event, String wireSchema)¶ Fills the notification header in a builder instance.
- Parameters
notificationBuilder – the builder where fields should be filled
event – the event to serialize and to greb the data for the notification header from
wireSchema – the wire shema of the serialized data
fromNotification¶
-
public static Event
fromNotification
(Notification notification)¶ Build event from RSB Notification. Excludes user data de-serialization as it is bound to the converter configuration.
- Parameters
notification –
rsb.protocol.NotificationType.Notification
instance to deserialize- Returns
deserialized
Event
instance
fromNotification¶
-
public static Event
fromNotification
(Notification notification, ByteBuffer serializedData, ConverterSelectionStrategy<ByteBuffer> converters)¶ Builds an
Event
instance from arsb.protocol.NotificationType.Notification
and aByteBuffer
containing the event payload. This includes the deserialization of the payload using a specified converter strategy.- Parameters
notification – the notification with the event meta data
serializedData – the serialized data
converters – converter strategy to use for deserializing the data
- Throws
ConversionException – unable to deserialize the data with the specified converter stategy
- Returns
the constructed and complete event including the payload
serializeEventData¶
-
public static WireContents<ByteBuffer>
serializeEventData
(Event event, ConverterSelectionStrategy<ByteBuffer> converters)¶ Serializes the payload contained in an
Event
instance using a specifiedConverterSelectionStrategy
.- Parameters
event – event containing the data to serialize
converters – the converters to use
- Throws
ConversionException – error converting, e.g. no converter available or wrong class
- Returns
the serialized data including the generated wire schema