Class KafkaConnectorMetadataAdapter

java.lang.Object
com.lightstreamer.interfaces.metadata.MetadataProviderAdapter
com.lightstreamer.kafka.adapters.pub.KafkaConnectorMetadataAdapter
All Implemented Interfaces:
MetadataProvider

public class KafkaConnectorMetadataAdapter extends MetadataProviderAdapter
Implementation of a Lightstreamer Metadata Adapter for Lightstreamer Kafka Connector.

For the sake of simplicity, this documentation shows only the hook methods.

  • Constructor Details

    • KafkaConnectorMetadataAdapter

      public KafkaConnectorMetadataAdapter()
  • Method Details

    • postInit

      protected void postInit(Map params, File configDir) throws MetadataProviderException
      Hook method invoked by Lightstreamer Kernel after the initialization phase of the Kafka Connector Metadata Adapter has been completed.
      Parameters:
      params - a Map-type value object that contains name-value pairs corresponding to the param elements supplied in the KafkaConnector configuration file under the <metadata_provider> element
      configDir - the path of the directory on the local disk where the KafkaConnector configuration file resides
      Throws:
      MetadataProviderException - if an error occurs that prevents the correct behavior of the Metadata Adapter. This causes the Server not to complete the startup and to exit.
      See Also:
    • getSchema

      public String[] getSchema(String user, String sessionID, String group, String dataAdapter, String schema) throws ItemsException, SchemaException
      Resolves a Field List specification supplied in a Request. The names of the Fields in the List are returned.

      Field List specifications are expected to be formed by simply concatenating the names of the contained Fields, in a space separated way.

      Parameters:
      user - a User name
      sessionID - a Session ID
      group - the name of the Item Group (or specification of the Item List) whose Items the Schema is to be applied to
      dataAdapter - the name of the Data Adapter to which the subscription is targeted
      schema - a Field Schema name (or Field List specification)
      Returns:
      an array with the names of the Fields in the Schema
      Throws:
      ItemsException - if the supplied Item Group name (or Item List specification) is not recognized
      SchemaException - if the supplied Field Schema name (or Field List specification) is not recognized
    • remapItems

      public String[] remapItems(String user, String sessionID, String itemList, String dataAdapter) throws ItemsException
      Remaps a list of items for a specific user session and data adapter.

      This method processes a whitespace-separated string of items and converts it into an array of individual item names. If the input is null or empty after trimming, an empty array is returned.

      Override this method to provide custom item resolution logic

      Parameters:
      user - a User name
      sessionID - a Session ID
      itemList - an Item List specification (whitespace-separated item names)
      dataAdapter - the name of the Data Adapter to which the Item List is targeted
      Returns:
      an array of strings containing the individual item names, or an empty array if the input is null or empty
      Throws:
      ItemsException - if there are issues with the items during the remapping process
    • onSubscription

      public void onSubscription(@Nullable String user, @Nonnull String sessionID, @Nonnull TableInfo[] tables) throws CreditsException, NotificationException
      Hook method invoked by Lightstreamer Kernel to notify that a user has submitted a Subscription.

      In this default implementation, the KafkaConnector Metadata Adapter does nothing.

      Parameters:
      user - a user name
      sessionID - the ID of a session owned by the user
      tables - an array of TableInfo instances, each of them containing the details of a Subscription to be added to the session
      Throws:
      CreditsException - if the user is not allowed to submit the Subscription
      NotificationException - if something is wrong in the parameters, such as the sessionID of a session that is not currently open or inconsistent information about the Subscription
      See Also:
    • onUnsubscription

      public void onUnsubscription(@Nonnull String sessionID, @Nonnull TableInfo[] tables) throws NotificationException
      Hook method invoked by Lightstreamer Kernel to notify that a Subscription has been removed from a push session.

      In this default implementation, the KafkaConnector Metadata Adapter does nothing.

      Parameters:
      sessionID - the ID of a session owned by the user
      tables - an array of TableInfo instances, each of them containing the details of a Subscription that has been removed from the session
      Throws:
      NotificationException - if something is wrong in the parameters, such as the sessionID of a session that is not currently open or inconsistent information about the Subscription
      See Also: