m2etis  0.4
M2etis Documentation

Overview

Massive Multiuser Event InfraStructure(M2etis) is a framework for optimizing event dissemination via a Peer-to-Peer(p2p) network

Architecture of M2etis

m2etis_Architektur.png

UML diagram of M2etis

uml-diagramm.png

Usage by application

The class m2etis::pubsub::PubSubSystem is the main entry point of the PubSub-Component of M2etis.

Code-Example

1 #include <iostream>
2 
6 
8 public:
9  void deliverCallback(const m2etis::message::M2etisMessage::Ptr m) {
10  std::cout << this << " received a message!" << std::endl;
11  }
12 };
13 
14 int main() {
15  DCB d1, d2;
16  m2etis::pubsub::PubSubSystem p1("127.0.0.1", 12345, "127.0.0.1", 12345, { "127.0.0.1" });
17  m2etis::pubsub::PubSubSystem p2("127.0.0.1", 12346, "127.0.0.1", 12345, { "127.0.0.1" });
18 
19  p1.subscribe<CharVectorEventType>(m2etis::pubsub::ChannelName::TEST_Direct_Null_Null_Null_Null_Null_Null_Null_CharVector_TCP, d1);
20  p2.subscribe<CharVectorEventType>(m2etis::pubsub::ChannelName::TEST_Direct_Null_Null_Null_Null_Null_Null_Null_CharVector_TCP, d2);
21 
22  m2etis::message::M2etisMessage::Ptr m1 = p1.createMessage<CharVectorEventType>(m2etis::pubsub::ChannelName::TEST_Direct_Null_Null_Null_Null_Null_Null_Null_CharVector_TCP);
23  p1.publish<CharVectorEventType>(m2etis::pubsub::ChannelName::TEST_Direct_Null_Null_Null_Null_Null_Null_Null_CharVector_TCP, m1);
24 
25  m2etis::message::M2etisMessage::Ptr m2 = p1.createMessage<CharVectorEventType>(m2etis::pubsub::ChannelName::TEST_Direct_Null_Null_Null_Null_Null_Null_Null_CharVector_TCP);
26  p2.publish<CharVectorEventType>(m2etis::pubsub::ChannelName::TEST_Direct_Null_Null_Null_Null_Null_Null_Null_CharVector_TCP, m2);
27 
28  system("PAUSE");
29 
30  return 0;
31 }
boost::shared_ptr< M2Message< EventType > > Ptr
Definition: M2Message.h:42
BasicChannelInterface< EventType > & subscribe(const ChannelName channel, BasicDeliverCallbackInterface< EventType > &callback)
User subscribes to the requested channel.
Definition: PubSubSystem.h:178
M2ETIS_API typedef BasicDeliverCallbackInterface< std::vector< unsigned char > > DeliverCallbackInterface
class for accessing the m2etis pub/sub system. It is the main entry point for the usage of the m2etis...
Definition: PubSubSystem.h:60
  • line 7-12: declares class being able to receive messages deriving from m2etis::pubsub::DeliverCallbackInterface
  • line 9-11: is the actual deliverCallback where messages arrive
  • line 16: inits a node with own port 12345 and root port 12345 (so this node will be the root node)
  • line 17: inits a node with own port 12346 and root port 12345 (so this node will not be root node)
  • line 19-20: both nodes subscribe on one of the predefined topics
  • line 22/25: creates a publish message for each of the nodes
  • line 23/26: publishes the message on the chosen topic

Key based routing(KBR) API

m2etis::net::NetworkInterface represents the KBR-API. It is an abstraction of the basic functionality of P2P-Networks using KBR.

Routing_einer_Nachricht.png

NetworkController

m2etis::net::NetworkController implements the m2etis::net::NetworkCallbackInterface and represents the connection between the PubSub-Component and the P2P-Network. It has the needed functionality for m2etis::pubsub::Channel for sending messages to the network

Links