ajKafkaSendMessage function
Available since AlchemyJ v4.2.1
Description
The ajKafkaSendMessage function sends a message to a Kafka server. Please take note that to run this function from Excel, you would need to set up the Kafka Connection in ##ExternalResources.
Syntax
ajKafkaSendMessage(topic_name, message,[sync],[timeout],[kafka_connection_id],[run_condition],[run_by_function_point_only])
Argument Name | Argument Type | Description |
---|---|---|
topic_name (required) | String | The topic name for the Kafka message. |
message (required) | Variant | The content for the Kafka message from a range of cell. The range of cells can be span across multiple rows and columns. All the cells will be concatenated |
sync (optional) | Boolean | If it equals TRUE, it will wait Kafka finish the send action. If it equals FALSE, it will not wait Kafka finish the send action. The default value is FALSE. |
timeout (optional) | Integer | The timeout time (milisecond) if sync is True. |
kafka_connection_id (optional) | String | The parameter is used to define which Kafka shall be executed for the function.The default value is primary. |
run_condition (optional) | Boolean | The function will run when the value is TRUE. Otherwise, it will not run. The default value is TRUE. |
run_by_function_point_only (optional) | Boolean | If it equals FALSE, the function can be executed through ‘Excel Calculation’ (can be either Automatic or Manual, Calculate Now or Calculate Sheet) or Preview Function Point. If it equals TRUE, the function can be executed with Preview Function Point (AlchemyJ ribbon \ Preview Function Point) only. The default value is TRUE. |
The function will return:
1) Return Value: TRUE / #VALUE!
2) Return Type: Single Value
Example
- Setup the Kafka connection in ##ExternalResources.
- Make sure the AlchemyJ Function Proxy was started up when executing ajKafkaSendMessage in the AlchemyJ workbook. The proxy will be started up automatically when run the Preview Function Point from AlchemyJ ribbon. Or you can start the proxy from More Tools - Run AlchemyJ Function Proxy.
- Use below formula send a message to Kafka service. Result TRUE returned means the message has been delivered successully.
=ajKafkaSendMessage(B1,B2,,,,,B7)
- The message can be retrieved in the defined Kafka server.
Error Scenarios
It will return #VALUE! when missing any required parameter or mismatch parameter type. Besides, system will raise error for below scenario(s).
Error Scenario |
---|
Kafka send message failed. |
Kafka init failed. |
Kafka close failed. |