Class KafkaConnectorMetadataAdapter
java.lang.Object
com.lightstreamer.interfaces.metadata.MetadataProviderAdapter
com.lightstreamer.kafka.adapters.pub.KafkaConnectorMetadataAdapter
- All Implemented Interfaces:
MetadataProvider
Implementation of a Lightstreamer Metadata Adapter for Lightstreamer Kafka Connector.
For the sake of simplicity, this documentation shows only the hook methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]
Resolves a Field List specification supplied in a Request.void
onSubscription
(String user, String sessionID, TableInfo[] tables) Hook method invoked by Lightstreamer Kernel to notify that a user has submitted a Subscription.void
onUnsubscription
(String sessionID, TableInfo[] tables) Hook method invoked by Lightstreamer Kernel to notify that a Subscription has been removed from a push session.protected void
Hook method invoked by Lightstreamer Kernel after the initialization phase of the Kafka Connector Metadata Adapter has been completed.String[]
remapItems
(String user, String sessionID, String itemList, String dataAdapter) Remaps a list of items for a specific user session and data adapter.Methods inherited from class com.lightstreamer.interfaces.metadata.MetadataProviderAdapter
customizeUpdate, customizeUpdate, enableUpdateCustomization, enableUpdateCustomization, getAllowedBufferSize, getAllowedBufferSize, getAllowedMaxBandwidth, getAllowedMaxItemFrequency, getAllowedMaxItemFrequency, getDistinctSnapshotLength, getDistinctSnapshotLength, getMinSourceFrequency, getMinSourceFrequency, isModeAllowed, isModeAllowed, isSelected, isSelected, isSelectorAllowed, isSelectorAllowed, modeMayBeAllowed, modeMayBeAllowed, notifyMpnDeviceAccess, notifyMpnDeviceTokenChange, notifyMpnSubscriptionActivation, notifyNewSession, notifyNewSession, notifySessionClose, notifyUser, notifyUser, notifyUserMessage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.lightstreamer.interfaces.metadata.MetadataProvider
getSessionTimeToLive, setListener
-
Constructor Details
-
KafkaConnectorMetadataAdapter
public KafkaConnectorMetadataAdapter()
-
-
Method Details
-
postInit
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 theparam
elements supplied in the KafkaConnector configuration file under the<metadata_provider>
elementconfigDir
- 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 namesessionID
- a Session IDgroup
- the name of the Item Group (or specification of the Item List) whose Items the Schema is to be applied todataAdapter
- the name of the Data Adapter to which the subscription is targetedschema
- 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 recognizedSchemaException
- 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 namesessionID
- a Session IDitemList
- 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 namesessionID
- the ID of a session owned by the usertables
- 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 SubscriptionNotificationException
- if something is wrong in the parameters, such as thesessionID
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 usertables
- 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 thesessionID
of a session that is not currently open or inconsistent information about the Subscription- See Also:
-