Write Log Messages to Topic From Pulsar Functions

Опубликовано: 04 Октябрь 2024
на канале: StreamNative Academy
59
1

Videos in this playlist were created using StreamNative Hosted, a fully-hosted Pulsar cluster option available from StreamNative. Configuration and functionality in other StreamNative Managed products are similar but may differ slightly.

Pulsar Functions on StreamNative Cloud Playlist
   • Pulsar Functions on StreamNative Cloud  

yaml file:
logTopic: "persistent://functiontenant/functionnamespace/functionlogtopic"

import org.slf4j.Logger;
import java.util.Collection;

Logger LOG = ctx.getLogger();
String functionName = ctx.getFunctionName();
Collection inputTopics = ctx.getInputTopics();
String outputTopic = ctx.getOutputTopic();

LOG.info("Rejected message " + input + " from function " + functionName + " with filter " + my_filter_string + " from topics " + inputTopics + " to topic " + outputTopic);

pulsarctl functions update --function-config-file ./MyFunctionConfig/AccessUserConfigWithSDK.yaml