Skip to content

Instantly share code, notes, and snippets.

@riyafa
Created March 8, 2019 06:35
Show Gist options
  • Save riyafa/701f23b50f3a2e899f2771e44ef556b2 to your computer and use it in GitHub Desktop.
Save riyafa/701f23b50f3a2e899f2771e44ef556b2 to your computer and use it in GitHub Desktop.
A point to point producer using ActiveMQ Artemis connector for Ballerina
import ballerina/artemis;
import ballerina/log;
import ballerina/io;
public function main() {
artemis:Producer prod = new({host:"localhost", port:61616}, "my_queue");
map<string> msg = {"Hello":"World", "some":"world"};
byte[] vals = [1,2,2,3,3,2];
var err = prod->send(vals);
err = prod->send(msg);
if(err is error){
log:printError("Error occurred sending message", err = err);
}
if(!prod.isClosed()) {
err = prod->close();
if(err is error){
log:printError("Error occurred closing producer", err = err);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment