diff --git a/examples/kafka-hub/subscriber/subscriber_service.bal b/examples/kafka-hub/subscriber/subscriber_service.bal index fe87ca22..110fd79f 100644 --- a/examples/kafka-hub/subscriber/subscriber_service.bal +++ b/examples/kafka-hub/subscriber/subscriber_service.bal @@ -23,6 +23,7 @@ import ballerina/websubhub; final string topicName = os:getEnv("TOPIC_NAME") == "" ? "priceUpdate" : os:getEnv("TOPIC_NAME"); final string hubUrl = os:getEnv("HUB_URL") == "" ? "https://lb:9090/hub" : os:getEnv("HUB_URL"); final boolean unsubOnShutdown = os:getEnv("UNSUB_ON_SHUTDOWN") == "true"; +final boolean logHeaders = os:getEnv("LOG_HEADERS") == "true"; type OAuth2Config record {| string tokenUrl; @@ -106,6 +107,13 @@ service /JuApTOXq19 on securedSubscriber { remote function onEventNotification(websub:ContentDistributionMessage event) returns error? { json notification = check event.content.ensureType(); log:printInfo("Received notification", content = notification); + if logHeaders { + map? receivedHeaders = event.headers; + if receivedHeaders is () { + return; + } + log:printInfo("Received headers: ", headers = receivedHeaders); + } } }