Last active
January 3, 2016 05:39
-
-
Save aozturk/8417809 to your computer and use it in GitHub Desktop.
This file contains 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
void pub() { | |
// creates or gets the singleton AMS service | |
AMS::IService& service = AMS::IService::instance(); | |
// enables exhaustive logging (i.e. message received/sent) | |
service.debug_mode(); | |
// allows using global logger of AMS service | |
service.logger().information("publisher side running..."); | |
// either creates a new domain or joins an existing one | |
// unique domain name and application name are provided | |
service.create_domain("ams_test", "Test_PUB"); | |
// creates a publisher for the associated message | |
service.create_publisher<TestMsg>(); | |
// starts the reactor for communication | |
service.reactor_start(); | |
for (int i=0; i<100; ++i) | |
{ | |
// prepares a message to send | |
TestMsg msg; | |
msg.value = i; | |
msg.name = "testing."; | |
// sends the message to all subscribers | |
service.send_message(msg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment