| import com.rabbitmq.client.* | |
| @Grab(group='com.rabbitmq', module='amqp-client', version='1.7.2') | |
| factory = new ConnectionFactory() | |
| connection = factory.newConnection(HOST, PORT) | |
| channel = connection.createChannel() | |
| exchangeName = "exchange/$USER/jobs" | |
| durable = true | |
| channel.exchangeDeclare exchangeName, 'topic', durable | |
| properties = MessageProperties.PERSISTENT_BASIC | |
| properties.setContentType 'application/json' | |
| message = 'Hello, world!'.bytes | |
| channel.basicPublish exchangeName, '', properties, message | |
| channel.close() | |
| connection.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment