Last active
January 3, 2016 05:39
-
-
Save aozturk/8417823 to your computer and use it in GitHub Desktop.
Revisions
-
aozturk revised this gist
Sep 14, 2014 . 1 changed file with 20 additions and 20 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,33 +1,33 @@ // defines a handler class for the message first class TestMsgHandler : public AMS::IHandler { public: virtual void handle(AMS::IMsgObj *baseMsg) { TestMsg *msg = dynamic_cast<TestMsg *>(baseMsg); if (msg != 0) { // process message here } } }; void sub() { AMS::IService &service = AMS::IService::instance(); service.debug_mode(); service.logger().information("subscriber side running..."); // joins to the domain with unique application name service.create_domain("ams_test", "Test_SUB"); // creates a subscriber for the associated message service.create_subscriber<TestMsg>(); // attaches handler to the subscriber TestMsgHandler handler; service.subscribe<TestMsg>(handler); // starts the reactor for communication service.reactor_start(); // wait enough time here to receive messages sent by publisher // i.e. sleep } -
aozturk revised this gist
Sep 14, 2014 . 1 changed file with 21 additions and 21 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,33 +1,33 @@ // defines a handler class for the message first class TestMsgHandler : public AMS::IHandler { public: virtual void handle(AMS::IMsgObj *baseMsg) { TestMsg *msg = dynamic_cast<TestMsg *>(baseMsg); if (msg != 0) { // process message here } } }; void sub() { AMS::IService &service = AMS::IService::instance(); service.debug_mode(); service.logger().information("subscriber side running..."); // joins to the domain with unique application name service.create_domain("ams_test", "Test_SUB"); // creates a subscriber for the associated message service.create_subscriber<TestMsg>(); // attaches handler to the subscriber TestMsgHandler handler; service.subscribe<TestMsg>(handler); // starts the reactor for communication service.reactor_start(); // wait enough time here to receive messages sent by publisher // i.e. sleep } -
aozturk revised this gist
Jan 14, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -20,13 +20,14 @@ void sub() { // creates a subscriber for the associated message service.create_subscriber<TestMsg>(); // attaches handler to the subscriber TestMsgHandler handler; service.subscribe<TestMsg>(handler); // starts the reactor for communication service.reactor_start(); // wait enough time here to receive messages sent by publisher // i.e. sleep } -
aozturk created this gist
Jan 14, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ // defines a handler class for the message first class TestMsgHandler : public AMS::IHandler { public: virtual void handle(AMS::IMsgObj* baseMsg) { TestMsg* msg = dynamic_cast<TestMsg*>(baseMsg); if (msg != 0) { // process message here } } }; void sub() { AMS::IService& service = AMS::IService::instance(); service.debug_mode(); service.logger().information("subscriber side running..."); // joins to the domain with unique application name service.create_domain("ams_test", "Test_SUB"); // creates a subscriber for the associated message service.create_subscriber<TestMsg>(); // attaches handler to the subscriber TestMsgHandler handler; service.subscribe<TestMsg>(handler); // starts the reactor for communication service.reactor_start(); // wait enough here to receive messages sent by pusblisher // i.e. sleep }