Open tony-gutierrez opened 6 years ago
I have the same issue.
@tony-gutierrez I get the same issue. But when I pause for a while/ use nextTick in the event function, it do not raise duplicated message again.
Here's my workaround.
let client = null;
function createReceivers() {
// create receiver links
}
async function reconnectClient() {
client = new AMQP.Client(policy);
client.on('connection:opened', async function(){
logger.info('[ListenConn]: opened');
process.nextTick(createReceivers);
});
try{
await amqpConnListen.connect(config['MQ_CONNECT_STRING']);
}catch(err){
logger.error(err);
}
}
Have you tried listening to the connected
event instead of connection:opened
? That won't fire until your connection and session(s) have been initialized, at which point you should be able to do whatever you want with links, etc.
I have to use logic in a 'connection:opened' handler to send a sas token.
If I do anything with the client in this 'connection:opened' event handler, I get two calls to my "on message" handler, regardless of where my receiver was created. I have verified I am only creating one receiver, once.