Téléchargement des produits


Version anglaise


 

L'exécution des fonctions VaToolBxSendToAvroKafka et VaToolBxSendToAvroKafkaWithKey s'appuie sur un fichier de paramétrage, au format YML, définissant la configuration de chaque broker logique Adelia manipulé dans le source L4G par les deux fonctions VaToolBxSendToAvroKafka et VaToolBxSendToAvroKafkaWithKey.

 

Exemple de L4G :

APPELER_DLL 'VaToolBx.dll' 'VaToolBxSendToAvroKafka' 'myKafkaLogicalBroker' myTopic myInstance myReturnCode myReturnMessage

 

APPELER_DLL 'VaToolBx.dll' 'VaToolBxSendToAvroKafkaWithKey' 'myKafkaLogicalBroker' myTopic myInstance myKey myReturnCode myReturnMessage

 

Dans cet exemple, myKafkaLogicalBroker correspond à un broker logique dont les caractéristiques sont définies dans ce fichier de configuration.

 

Ce fichier est défini au démarrage de la jvm par la variable d'environnement com.hardis.adelia.kafka.configuration

.. -Dcom.hardis.adelia.kafka.configuration=C:\directory\AdeliaKafkaConfig.yml

 

Exemple de configuration pour démarrer Tomcat (en adaptant catalina.bat) :

Avant :

%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

 

Après :

%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" -Dcom.hardis.adelia.kafka.configuration="D:\MyConfig\AdeliaKafkaConfig.yml" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%


Ce fichier est lu lors de la première exécution de :

     CHARGER_DLL 'VaToolBx'

ou APPELER_DLL 'VaToolBxSendToAvroKafka'
ou APPELER_DLL 'VaToolBxSendToAvroKafkaWithKey'

 


Exemple de fichier de paramétrage :

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#
# Adelia Kafka settings (logical brokers from Adelia VaToolBxSendToAvroKafka & VaToolBxSendToAvroKafkaWithKey)
#    Example : CALL_DLL 'VaToolBx.dll' 'VaToolBxSendToAvroKafka' 'myKafkaLogicalBroker' Topic Instance ReturnCode ReturnMessage
#
# This file is defined when running jvm with -Dcom.hardis.adelia.kafka=C:\...\KafkaAdeliaConfig.yml
#    Example : update catalina.bat to launch Tomcat with this property
#

# Properties names :
#    Kafka  properties : bootstrap.servers, etc. please refer https://kafka.apache.org/documentation/#producerconfigs
#    Adelia properties : name starting with 'adelia.' for example 'adelia.sendmode'

# Adelia Kafka logical broker 'myKafkaLogicalBroker'
myKafkaLogicalBroker:
   # bootstrap.servers => a list of Kafka brokers
   bootstrap.servers: ps972.hardis.fr:9092
   # schema.registry.url => schema registry url (for example http://localhost:8081
   schema.registry.url: 
   # acks => number of acknowledgments the producer requires the leader to have received before considering a request complete (string value so "0" instead of 0).
   acks: "0"
   # retries => 0 so if the request fails then the producer does not retry
   retries: 0
   # max.block.ms => how long KafkaProducer.send() and KafkaProducer.partitionsFor() will block
   max.block.ms: 123
   # key.serializer => serializer class for key that implements the org.apache.kafka.common.serialization.Serializer interface.
   key.serializer: org.apache.kafka.common.serialization.StringSerializer
   # value.serializer => serializer class for value that implements the org.apache.kafka.common.serialization.Serializer interface.
   value.serializer: org.apache.kafka.common.serialization.ByteArraySerializer
   # producer.type => async
   producer.type: async
   # linger.ms => delay (default value 0) to define how the producer groups together any records that arrive in between request transmissions into a single batched request. 
   linger.ms: 0
   # adelia.client.id => client.id: id to pass to the server when making requests so the server can track the source of requests beyond just IP/port by passing a producer name for things like server-side request logging ('auto' value for host name for IP address sender).
   adelia.client.id: auto
   # adelia.partition => partition (if a valid partition number is specified that partition will be used when sending the record. If no partition is specified but a key is present a partition will be chosen using a hash of the key. If neither key nor partition is present a partition will be assigned in a round-robin fashion).
   # adelia.partition: 
  # adelia.sendmode => sending mode ('fireandforget' is default value)
   # adelia.sendmode: fireandforget

# Adelia Kafka logical broker 'myKafkaLogicalBroker2'
myKafkaLogicalBroker2:
   bootstrap.servers: ps123.hardis.fr:9092
   ..
   
# Adelia Kafka logical broker 'myKafkaLogicalBroker3'
myKafkaLogicalBroker3:
   bootstrap.servers: ps456.hardis.fr:9092   
   
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



 


Dans cet exemple, ce fichier définit la configuration de 3 brokers logiques : myKafkaLogicalBroker, myKafkaLogicalBroker2 et myKafkaLogicalBroker3.


Structure du document YML :

nomBrokerLogiqueAdelia1:

# ceci est une ligne de commentaire en YML car commence par un dièse

nompropriété1 : valeur1
nompropriété2 : valeur2
nompropriété3 : valeur3
..

nomBrokerLogiqueAdelia2:

ceci est une ligne de commentaire en YML car commence par un dièse
nompropriété1 : valeur1
nompropriété8 : valeur8
nompropriété11 : valeur11
..

..

 

Chaque propriété est soit une :

  • Propriété Apache Kafka Producer :
    L'ensemble des propriétés sont documentées ici.
    Par exemple : bootstrap.servers, acks, retries, etc.
  • Propriété spéciale Adelia (son nom commence par adelia.)
    Par exemple : 

adelia.partition

Si un numéro de partition (au sens Kafka) valide est spécifié, cette partition sera utilisée lors de l'envoi de l'enregistrement.
Si aucune partition n'est spécifiée mais qu'une clé est présente, une partition sera choisie en utilisant un hachage de la clé.
Si aucune clé ni partition n'est présente, une partition sera assignée tour à tour.

adelia.client.id 

Mappée sur la propriété client.id
Identifiant à transmettre au serveur lors des requêtes afin que celui-ci puisse suivre la source des requêtes au-delà de l'adresse IP / du port en transmettant un nom de producteur pour des tâches telles que la journalisation des requêtes côté serveur.
'auto' = adresse IP de l'expéditeur

 

↑ Haut de page

  • Aucune étiquette