Interface MessageSource

  • All Superinterfaces:
    ServiceType

    public interface MessageSource
    extends ServiceType
    Service type for data producer. Providers are publishing data to a specific event bus address.
    Author:
    Clement Escoffier
    • Method Detail

      • createRecord

        static Record createRecord​(String name,
                                   String address,
                                   String type,
                                   JsonObject metadata)
        Create a record representing a data producer.
        Parameters:
        name - the name of the service
        address - the address on which the data is sent
        type - the type of payload (fully qualified name of the class)
        metadata - additional metadata
        Returns:
        the created record
      • createRecord

        static Record createRecord​(String name,
                                   String address,
                                   Class type,
                                   JsonObject metadata)
        Create a record representing a data producer.
        Parameters:
        name - the name of the service
        address - the address on which the data is sent
        type - the type of payload
        metadata - additional metadata
        Returns:
        the created record
      • getConsumer

        static <T> Future<MessageConsumer<T>> getConsumer​(ServiceDiscovery discovery,
                                                          JsonObject filter)
        Convenient method that looks for a message source and provides the configured MessageConsumer. The async result is marked as failed is there are no matching services, or if the lookup fails.
        Parameters:
        discovery - The service discovery instance
        filter - The filter, optional
        Returns:
        a future notified with the client
      • getConsumer

        static <T> Future<MessageConsumer<T>> getConsumer​(ServiceDiscovery discovery,
                                                          java.util.function.Function<Record,​Boolean> filter)
        Convenient method that looks for a message source and provides the configured MessageConsumer. The async result is marked as failed is there are no matching services, or if the lookup fails.
        Parameters:
        discovery - The service discovery instance
        filter - The filter, must not be null
        Returns:
        a future notified with the client