public class ByteArrayPubSubMessageSerDe extends IdentityPubSubMessageSerDe
Query
into its serialized bytes in the PubSubMessage
. When
invoking the PubSubMessage.getContentAsByteArray()
or PubSubMessage.getContentAsQuery()
, the payload
is lazily converted (and stored) as the appropriate type. This means that PubSubMessage.getContent()
will
return a byte[] or Query
depending on what was called before it. This can be used to send a Query
to the backend and if it is passed between multiple workers (i.e. serialized and deserialized multiple times), it
will not needlessly convert the Query
object multiple times.
This behaves like the IdentityPubSubMessageSerDe
for all other operations.config
Constructor and Description |
---|
ByteArrayPubSubMessageSerDe(BulletConfig config)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
PubSubMessage |
toMessage(String id,
Query query,
String queryString)
A helper to submit a query by converting it to a standard
PubSubMessage and running it through
PubSubMessageSerDe.toMessage(PubSubMessage) . |
fromMessage, toMessage
from
public ByteArrayPubSubMessageSerDe(BulletConfig config)
config
- The BulletConfig
to configure this class.public PubSubMessage toMessage(String id, Query query, String queryString)
PubSubMessageSerDe
PubSubMessage
and running it through
PubSubMessageSerDe.toMessage(PubSubMessage)
.toMessage
in class PubSubMessageSerDe
id
- The ID for the query.query
- The Query
object to create a PubSubMessage
.queryString
- The BQL for the query.PubSubMessage
.Copyright © 2021. All rights reserved.