Hi I have created a topic in pulsar and produced...
# general
p
Hi I have created a topic in pulsar and produced messages to the topic. But unable to consume it. I can able to see the topic has backlog messages.
a
You might have to set the
subscriptionInitialPosition
to “earliest” so your consumer receives the message
p
"my-subscription" : { "msgRateOut" : 0.0, "msgThroughputOut" : 0.0, "bytesOutCounter" : 0, "msgOutCounter" : 0, "msgRateRedeliver" : 0.0, "messageAckRate" : 0.0, "chunkedMessageRate" : 0, "msgBacklog" : 206, "backlogSize" : 390271, "earliestMsgPublishTimeInBacklog" : 0, "msgBacklogNoDelayed" : 206, "blockedSubscriptionOnUnackedMsgs" : false, "msgDelayed" : 0, "unackedMessages" : 0, "type" : "Shared", "msgRateExpired" : 0.0, "totalMsgExpired" : 0, "lastExpireTimestamp" : 0, "lastConsumedFlowTimestamp" : 1716114901174, "lastConsumedTimestamp" : 0, "lastAckedTimestamp" : 0, "lastMarkDeleteAdvancedTimestamp" : 0, "consumers" : [ ], "isDurable" : true, "isReplicated" : false, "allowOutOfOrderDelivery" : false, "consumersAfterMarkDeletePosition" : { }, "nonContiguousDeletedMessagesRanges" : 0, "nonContiguousDeletedMessagesRangesSerializedSize" : 0, "delayedMessageIndexSizeInBytes" : 0, "subscriptionProperties" : { }, "filterProcessedMsgCount" : 0, "filterAcceptedMsgCount" : 0, "filterRejectedMsgCount" : 0, "filterRescheduledMsgCount" : 0, "durable" : true, "replicated" : false } This is my topic stats
The backlog msg shows 206
But unable to consume it
can you suggest some pulsar admin command will check it
a
How do you create the consumer?
p
Using nodejs
a
Can you post the code snippet with the consumer creation?
p
await client.subscribe( { topic: 'cmi-cdr-webhooks’, subscriptionInitialPosition: 'Earliest', subscription: 'cmi-cdr-webhook-subscription', subscriptionType: 'Shared', ackTimeoutMs: 13000, // messages that aren't acknowledged within 13 seconds are redelivered negativeAckRedeliveryDelayMs: 60000, deadLetterPolicy: { maxRedeliverCount: 5, deadLetterTopic: 'cmi-cdr-webhooks-dlq', }, listener: async ( msg, msgConsumer ) => { console.log( msg ) const message = JSON.parse( msg.getData().toString() ); msgConsumer.acknowledge( msg ); });
Have you looked into it ?