Interface ITuplePublisher<I>

  • Type Parameters:
    I - type of the identifiers of messages
    All Known Implementing Classes:
    AutoCommitTuplePublisher, AutoHandleDatastoreSchemaAlterationsTuplePublisher, TuplePublisher

    public interface ITuplePublisher<I>
    Encapsulates the business logic to publish a series of tuples in the context of one message.

    Depending on the data source and the configuration of the data source, some messages are published all at once, while some messages are published chunk by chunk, in multiple passes.

    A tuple publisher is used in the last step of the IStoreMessageChannel processing sequence, once the message content has been converted into tuples: it is in charge of effectively posting these tuples to the Datastore in a transactional manner. Thus, implementing classes shall make use of the Datastore API - especially by leveraging the ITransactionManager associated to the target Datastore - to publish the tuples in the datastore.

    Different implementation of tuple publisher may help to control the transaction flow in different ways, e.g. one transaction for each message processed in a given channel, or one transaction spanning across multiple messages and channels. Therefore, the tuple publisher may or may NOT effectively manage the start/commit of transactions.

    Author:
    ActiveViam
    • Method Detail

      • publish

        void publish​(IStoreMessage<? extends I,​?> message,
                     List<Object[]> tuples)
        Publish a series of tuples, with a given message context. NOTICE - Although some message implementations may exhibit references to tuples they contain, it is expected that this publish action will focus on the specific set of tuples that is specified in the second argument. The message context here is provided rather as a helper for extra operations that might (this is optional!) be required on the tuples before final publishing to the target Datastore.
        Parameters:
        message - the message to which the tuples belong. It contains metadata information that can be used to manipulate (e.g. read/write) the information contained in the tuples.
        tuples - the effective set of tuples to be published.
      • getTargetStores

        Collection<String> getTargetStores()
        Returns the target stores where to publish.
        Returns:
        the target stores where to publish