void CheckerComponent::Start(void)
{
- m_Endpoint = Endpoint::MakeEndpoint("checker", true);
+ m_Endpoint = Endpoint::MakeEndpoint("checker", false);
/* dummy registration so the delegation module knows this is a checker
TODO: figure out a better way for this */
*/
void DemoComponent::Start(void)
{
- m_Endpoint = Endpoint::MakeEndpoint("demo", true);
+ m_Endpoint = Endpoint::MakeEndpoint("demo", false);
m_Endpoint->RegisterTopicHandler("demo::HelloWorld",
boost::bind(&DemoComponent::HelloWorldRequestHandler, this, _2,
_3));
*/
void ReplicationComponent::Start(void)
{
- m_Endpoint = Endpoint::MakeEndpoint("replication", true);
+ m_Endpoint = Endpoint::MakeEndpoint("replication", false);
DynamicObject::OnRegistered.connect(boost::bind(&ReplicationComponent::LocalObjectRegisteredHandler, this, _1));
DynamicObject::OnUnregistered.connect(boost::bind(&ReplicationComponent::LocalObjectUnregisteredHandler, this, _1));
* Helper function for creating new endpoint objects.
*
* @param name The name of the new endpoint.
+ * @param replicated Whether replication is enabled for the endpoint object.
* @param local Whether the new endpoint should be local.
* @returns The new endpoint.
*/
-Endpoint::Ptr Endpoint::MakeEndpoint(const String& name, bool local)
+Endpoint::Ptr Endpoint::MakeEndpoint(const String& name, bool replicated, bool local)
{
ConfigItemBuilder::Ptr endpointConfig = boost::make_shared<ConfigItemBuilder>();
endpointConfig->SetType("Endpoint");
endpointConfig->SetName(local ? "local:" + name : name);
- endpointConfig->SetLocal(local ? 1 : 0);
+ endpointConfig->SetLocal(!replicated);
endpointConfig->AddExpression("local", OperatorSet, local);
DynamicObject::Ptr object = endpointConfig->Compile()->Commit();
String GetNode(void) const;
String GetService(void) const;
- static Endpoint::Ptr MakeEndpoint(const String& name, bool local);
+ static Endpoint::Ptr MakeEndpoint(const String& name, bool replicated, bool local = true);
static boost::signal<void (const Endpoint::Ptr&)> OnConnected;
static boost::signal<void (const Endpoint::Ptr&)> OnDisconnected;
if (object)
m_Endpoint = dynamic_pointer_cast<Endpoint>(object);
else
- m_Endpoint = Endpoint::MakeEndpoint(identity, false);
+ m_Endpoint = Endpoint::MakeEndpoint(identity, true, true);
}
/**
if (Endpoint::Exists(identity))
endpoint = Endpoint::GetByName(identity);
else
- endpoint = Endpoint::MakeEndpoint(identity, false);
+ endpoint = Endpoint::MakeEndpoint(identity, true);
endpoint->SetClient(jclient);
}
if (!endpoint->IsLocalEndpoint())
continue;
- String topic;
- BOOST_FOREACH(tie(tuples::ignore, topic), endpoint->GetSubscriptions()) {
- subscriptions->Set(topic, topic);
+ if (endpoint->GetSubscriptions()) {
+ String topic;
+ BOOST_FOREACH(tie(tuples::ignore, topic), endpoint->GetSubscriptions()) {
+ subscriptions->Set(topic, topic);
+ }
}
}