Configuring the components
Procedure
-
Double-click the cTimer component to
display its Basic settings view in the Component tab. Keep the default settings of the options as
shown below.
-
Double-click the first cSetBody
component, which is labeled SetBodyAsJsonString, to open its
Basic settings view in the Component tab.
- Select Constant from the Language drop-down list and type in the JSON string "{\"my_field1\": 1,\"my_field2\": 72438939,\"my_field3\": \"my demo Test message\"}" in the Expression field as the message body.
-
Click the Component tab of the first cMap component, which is labeled
ConvertBodyToAvro and open its Basic settings view.
- Click the [...] button next to the Map Path field and select the map “Avro/Sample_JSON_to_AVRO”.
- Select Object from the Output Type drop-down list.
-
Click the Component tab of the second
cMap component, which is labeled
ConvertBodyToJsonString and open its Basic
settings.
- Click the [...] button next to the Map Path field and select the map “Avro/Sample_AVRO_to_JSON”.
- Select Byte Array from the Output Type drop-down list.
-
Double-click the first cKafka
component, which is labeled SendMessageToKafka, to open its
Basic settings view in the Component tab.
-
In the Broker List field, enter
"localhost:9092".
In the Topic field, enter "demo.AVRO".In the Serializer Class field, enter "org.example.local_project.beansjar.kafka_avro_beans.KafkaAvroSerializerBean". Make sure you replace local_project with the Talend project name.Keep the default settings of the other options.
-
Open Advanced settings view in the
Component tab.
- In the Kafka Properties field, add a parameter with the name "schemaRegistryURL" and the value "localhost:8081".
-
Double-click the second cKafka component, which is labeled
ReceiveMessageFromKafka, to open its Basic
settings view in the Component tab.
-
In the Broker List field, enter
"localhost:9092".
In the Topic field, enter "demo.AVRO".Keep the default settings of the other options.
-
Open Advanced settings view in the
Component tab.
- In the Kafka Properties field, add two parameters with the name "schemaRegistryURL" and "valueDeserializer", and the value "localhost:8081" and "org.example.local_project.beansjar.kafka_avro_beans.KafkaAvroDeserializerBean" respectively. Make sure you replace local_project with the Talend project name.
- Keep the default settings of the cLog components to log the message exchanges.
- Press Ctrl+S to save your Route.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!