You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/07/16 14:42:16 UTC
[GitHub] [pulsar] CoderCookE edited a comment on issue #11315: How to retry send message after send fail at async mode?
CoderCookE edited a comment on issue #11315:
URL: https://github.com/apache/pulsar/issues/11315#issuecomment-881499738
at least in node, and i'd imagine you can do something similar in Java, if you wrap the `send` method you'll have the `msg` in scope for your catch method to do whatever you want with on error.
```
exports.publish = async function(message, timestamp) {
const producer = await client.createProducer(producerConfig);
const msg = {
data: Buffer.from(message),
eventTimestamp: timestamp
};
producer.send(msg).catch(function(err) {
log.error({ message: `Error publishing: ${err}; dropping message`, msg: msg });
});
};
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org