Created
March 8, 2019 06:35
-
-
Save riyafa/701f23b50f3a2e899f2771e44ef556b2 to your computer and use it in GitHub Desktop.
A point to point producer using ActiveMQ Artemis connector for Ballerina
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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