Class SubscriptionMessageSerializer

java.lang.Object
org.axonframework.axonserver.connector.query.subscription.SubscriptionMessageSerializer

public class SubscriptionMessageSerializer extends Object
Converter between Axon Framework SubscriptionQueryMessage, the initial QueryResponseMessage and the subsequent SubscriptionQueryUpdateMessage's and Axon Server gRPC SubscriptionQuery and SubscriptionQueryResponse. The latter is serviced by providing a QueryProviderOutbound wrapping the SubscriptionQueryResponse.
Since:
4.0
Author:
Sara Pellegrini
  • Constructor Summary

    Constructors
    Constructor
    Description
    SubscriptionMessageSerializer(org.axonframework.serialization.Serializer messageSerializer, org.axonframework.serialization.Serializer serializer, AxonServerConfiguration configuration)
    Instantiate a serializer used to convert Axon SubscriptionQueryMessages, the initial QueryResponseMessage and the subsequent SubscriptionQueryUpdateMessages into Axon Server gRPC messages and vice versa.
  • Method Summary

    Modifier and Type
    Method
    Description
    <I> org.axonframework.queryhandling.QueryResponseMessage<I>
    deserialize(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse)
    Deserializes the given queryResponse into a QueryResponseMessage.
    <U> org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<U>
    deserialize(io.axoniq.axonserver.grpc.query.QueryUpdate queryUpdate)
    Deserializes the given queryUpdate into a SubscriptionQueryUpdateMessage.
    <Q, I, U> org.axonframework.queryhandling.SubscriptionQueryMessage<Q,I,U>
    deserialize(io.axoniq.axonserver.grpc.query.SubscriptionQuery subscriptionQuery)
    Deserializes the given subscriptionQuery into a SubscriptionQueryMessage.
    io.axoniq.axonserver.grpc.query.SubscriptionQuery
    serialize(org.axonframework.queryhandling.SubscriptionQueryMessage<?,?,?> subscriptionQueryMessage)
    Deprecated.
    in through use of the AxonServer java connector
    io.axoniq.axonserver.grpc.query.QueryUpdate
    serialize(org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<?> subscriptionQueryUpdateMessage)
    Serializes the given subscriptionQueryUpdateMessage into a QueryUpdate.
    io.axoniq.axonserver.grpc.query.QueryRequest
    serializeQuery(org.axonframework.queryhandling.SubscriptionQueryMessage subscriptionQueryMessage)
    Serializes the given subscriptionQueryMessage into a QueryRequest.
    io.axoniq.axonserver.grpc.SerializedObject
    serializeUpdateType(org.axonframework.queryhandling.SubscriptionQueryMessage<?,?,?> subscriptionQueryMessage)
    Serializes the given subscriptionQueryMessage into a SerializedObject.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SubscriptionMessageSerializer

      public SubscriptionMessageSerializer(org.axonframework.serialization.Serializer messageSerializer, org.axonframework.serialization.Serializer serializer, AxonServerConfiguration configuration)
      Instantiate a serializer used to convert Axon SubscriptionQueryMessages, the initial QueryResponseMessage and the subsequent SubscriptionQueryUpdateMessages into Axon Server gRPC messages and vice versa.
      Parameters:
      messageSerializer - a Serializer used to de-/serialize an Axon Server gRPC message into SubscriptionQueryMessages, QueryResponseMessages and SubscriptionQueryUpdateMessages, and vice versa
      serializer - a Serializer used to create a dedicated converter for a QueryMessage ResponseType
      configuration - an AxonServerConfiguration used to set the configurable component id and name in the messages
  • Method Details

    • serializeQuery

      public io.axoniq.axonserver.grpc.query.QueryRequest serializeQuery(org.axonframework.queryhandling.SubscriptionQueryMessage subscriptionQueryMessage)
      Serializes the given subscriptionQueryMessage into a QueryRequest.
      Parameters:
      subscriptionQueryMessage - the SubscriptionQueryMessage to serialize into a QueryRequest
      Returns:
      a QueryRequest based on the given subscriptionQueryMessage
    • serializeUpdateType

      public io.axoniq.axonserver.grpc.SerializedObject serializeUpdateType(org.axonframework.queryhandling.SubscriptionQueryMessage<?,?,?> subscriptionQueryMessage)
      Serializes the given subscriptionQueryMessage into a SerializedObject.
      Parameters:
      subscriptionQueryMessage - the SubscriptionQueryMessage who's SubscriptionQueryMessage.getUpdateResponseType() to serialize into a SerializedObject
      Returns:
      a SerializedObject based on the given subscriptionQueryMessage its SubscriptionQueryMessage.getUpdateResponseType()
    • serialize

      public io.axoniq.axonserver.grpc.query.QueryUpdate serialize(org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<?> subscriptionQueryUpdateMessage)
      Serializes the given subscriptionQueryUpdateMessage into a QueryUpdate.
      Parameters:
      subscriptionQueryUpdateMessage - the SubscriptionQueryUpdateMessage to serialize into a QueryUpdate
      Returns:
      the QueryUpdate based on the given SubscriptionQueryUpdateMessage
    • deserialize

      public <Q, I, U> org.axonframework.queryhandling.SubscriptionQueryMessage<Q,I,U> deserialize(io.axoniq.axonserver.grpc.query.SubscriptionQuery subscriptionQuery)
      Deserializes the given subscriptionQuery into a SubscriptionQueryMessage.
      Type Parameters:
      Q - the query type of the SubscriptionQueryMessage to return
      I - the initial result type of the SubscriptionQueryMessage to return
      U - the update type of the SubscriptionQueryMessage to return
      Parameters:
      subscriptionQuery - the SubscriptionQuery to deserialize into a SubscriptionQueryMessage
      Returns:
      the SubscriptionQueryMessage based on the given subscriptionQuery
    • deserialize

      public <I> org.axonframework.queryhandling.QueryResponseMessage<I> deserialize(io.axoniq.axonserver.grpc.query.QueryResponse queryResponse)
      Deserializes the given queryResponse into a QueryResponseMessage. Typically used for the initial result of the subscription query.
      Type Parameters:
      I - the response type of the QueryResponseMessage to return
      Parameters:
      queryResponse - the QueryResponse to deserialize into a QueryResponseMessage
      Returns:
      a QueryResponseMessage based on the given QueryResponse
    • deserialize

      public <U> org.axonframework.queryhandling.SubscriptionQueryUpdateMessage<U> deserialize(io.axoniq.axonserver.grpc.query.QueryUpdate queryUpdate)
      Deserializes the given queryUpdate into a SubscriptionQueryUpdateMessage.
      Type Parameters:
      U - the update type of the SubscriptionQueryUpdateMessage to return
      Parameters:
      queryUpdate - the QueryUpdate to deserialize into a SubscriptionQueryUpdateMessage
      Returns:
      a SubscriptionQueryUpdateMessage based on the given QueryUpdate
    • serialize

      @Deprecated public io.axoniq.axonserver.grpc.query.SubscriptionQuery serialize(org.axonframework.queryhandling.SubscriptionQueryMessage<?,?,?> subscriptionQueryMessage)
      Deprecated.
      in through use of the AxonServer java connector
      Convert a SubscriptionQueryMessage into a SubscriptionQuery.
      Parameters:
      subscriptionQueryMessage - the SubscriptionQueryMessage to convert into a SubscriptionQuery
      Returns:
      a SubscriptionQuery based on the provided subscriptionQueryMessage