Interface SessionedJsonifiable


  • public interface SessionedJsonifiable
    Jsonifiable with information from the streaming session.
    • Method Detail

      • getJsonifiable

        org.eclipse.ditto.model.base.json.Jsonifiable.WithPredicate<org.eclipse.ditto.json.JsonObject,​org.eclipse.ditto.json.JsonField> getJsonifiable()
        Retrieve the Jsonifiable.
        Returns:
        the Jsonifiable.
      • getDittoHeaders

        org.eclipse.ditto.model.base.headers.DittoHeaders getDittoHeaders()
        Retrieve the Ditto headers of the Jsonifiable.
        Returns:
        the Ditto headers.
      • retrieveExtraFields

        CompletionStage<org.eclipse.ditto.json.JsonObject> retrieveExtraFields​(@Nullable
                                                                               SignalEnrichmentFacade facade)
        Retrieve extra fields for the Jsonifiable according to the session information. If the Jsonifiable does not support extra fields, then a future empty Json object is returned. If the Jsonifiable supports extra fields but retrieval is impossible, then a failed future is returned.
        Parameters:
        facade - the signal enrichment facade with which extra fields are retrieved.
        Returns:
        future of the result of retrieval.
      • getSession

        Optional<StreamingSession> getSession()
        Retrieve the streaming session if this is a signal and has an associated session.
        Returns:
        the session if any exists.
      • signal

        static SessionedJsonifiable signal​(org.eclipse.ditto.signals.base.Signal<?> signal,
                                           org.eclipse.ditto.model.base.headers.DittoHeaders sessionHeaders,
                                           StreamingSession session)
        Create a sessioned Jsonifiable for a signal.
        Parameters:
        signal - the signal.
        sessionHeaders - headers of the request that created the streaming session.
        session - session information for the signal's streaming type.
        Returns:
        the sessioned Jsonifiable.
      • error

        static SessionedJsonifiable error​(org.eclipse.ditto.model.base.exceptions.DittoRuntimeException error)
        Create a sessioned Jsonifiable for an error.
        Parameters:
        error - the error.
        Returns:
        the sessioned Jsonifiable.
      • response

        static SessionedJsonifiable response​(org.eclipse.ditto.signals.commands.base.CommandResponse<?> response)
        Create a sessioned Jsonifiable for a response.
        Parameters:
        response - the response.
        Returns:
        the sessioned Jsonifiable.
      • subscription

        static SessionedJsonifiable subscription​(org.eclipse.ditto.signals.events.thingsearch.SubscriptionEvent<?> subscriptionEvent)
        Create a sessioned Jsonifiable for a SubscriptionEvent as response.
        Parameters:
        subscriptionEvent - the SubscriptionEvent as response.
        Returns:
        the sessioned Jsonifiable.
      • ack

        static SessionedJsonifiable ack​(StreamingType streamingType,
                                        boolean subscribed,
                                        CharSequence connectionCorrelationId)
        Create a sessioned Jsonifiable for a stream acknowledgement.
        Parameters:
        streamingType - the streaming type.
        subscribed - whether a subscription or an unsubscription is acknowledged..
        connectionCorrelationId - the correlation ID of the streaming session.
        Returns:
        the sessioned Jsonifiable.