examples/src/example-amqp-publish.js
// And finally, we can set up, let's create a main method to hold our logic...
And finally, we can set up, let's create a main method to hold our logic
And finally we can set up let ' s create a main method to hold our logic
async function main() {
  await amqpCacoon.getPublishChannel();
  const messageAsBuffer = Buffer.from(`Hi. Today is ${new Date().toString()}`);
  await amqpCacoon.publish(amqpConfig.exampleExchange, '', messageAsBuffer);
  amqpCacoon.close();
}
async function main ( ) { await amqpCacoon . getPublishChannel ( ) ; const messageAsBuffer = Buffer . from ( ` ${ new Date ( ) . toString ( ) } ` ) ; await amqpCacoon . publish ( amqpConfig . exampleExchange , '' , messageAsBuffer ) ; amqpCacoon . close ( ) ; }
And finally, we can set up, let's create a main method to hold our logic...
And finally we can set up let ' s create a main method to hold our logic ...
// Connects and sets up a subscription channelWrapper // Create the message as a Buffer (since that's required by the underlying libraries) // Publish // Close the connection