本文整理汇总了C#中Event.getTopic方法的典型用法代码示例。如果您正苦于以下问题:C# Event.getTopic方法的具体用法?C# Event.getTopic怎么用?C# Event.getTopic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event.getTopic方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sentToSubscriberFIFO
private void sentToSubscriberFIFO(string name, Event e)
{
bool existsTopic = false;
lock (this)
{
//}
if (!(this.lastSeqNumber.ContainsKey(name)))
{
try
{
lastSeqNumber.Add(name, 0);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
// Console.WriteLine("Event iD ->" + e.getNumber() + "FROM " + e.getSender());
foreach (KeyValuePair<string, string> kvp in topicSubs)
{
if (itsForSend(kvp, e.getTopic()))
{
Console.WriteLine("Found a Subscriber:" + kvp.Value);
existsTopic = true;
if (lastSeqNumber[name] + 1 == e.getNumber())
{
ISubscriber sub = (ISubscriber)Activator.GetObject(
typeof(ISubscriber),
kvp.Value);
Console.WriteLine("Sending to : " + kvp.Value + " EVENT :" + e.getNumber() + "FROM:" + name);
sub.receiveEvent(e.getSender(), e);
events.Add(new KeyValuePair<string, Event>(name, e));
sendToPM("SubEvent " + sub.getName() + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
// Console.WriteLine("COME ON IN");
if (queueEvents.Contains(e))
queueEvents.Remove(e);
lastSeqNumber[name] += 1;
// Console.WriteLine("SENT SUB WITH EVENT NUMBER:" + e.getNumber() + " AND SEQNUMB: " + lastSeqNumber[name] + " PUB:" + e.getSender());
getNextFIFOE(name, e);
}
else
{
Console.WriteLine("Go to Priority, Event:" + e.getNumber());
queueEvents.Add(e);
// getNextFIFOE(name, lastSeqNumber[name] + 1);
}
}
}
if (!existsTopic)
{
if ((lastSeqNumber[name] + 1 == e.getNumber()) && (name.Equals(e.getSender())))
{
lastSeqNumber[name] += 1;
getNextFIFOE(name, e);
}
else
{
queueEvents.Add(e);
//getNextFIFOE(name, e);
}
}
}
}
示例2: sendToSubscriber
public void sendToSubscriber(Event e)
{
foreach (KeyValuePair<string,string> kvp in topicSubs)
{
Console.WriteLine("Event iD ->" + e.getNumber());
if (itsForSend(kvp , e.getTopic()))
{
ISubscriber sub = (ISubscriber)Activator.GetObject(
typeof(ISubscriber),
kvp.Value);
Console.WriteLine("Sending to : " + kvp.Value);
sub.receiveEvent(e.getSender(), e);
sendToPM("SubEvent "+sub.getName()+" , "+e.getSender()+" , "+e.getTopic()+" , "+e.getNumber());
}
}
}
示例3: receivePub
public string receivePub(string name, Event e)
{
if (isFrozen)
{
FrozenEvent fe = new FrozenEvent("EVENT",e);
frozenEvents.Add(fe);
return "ACK";
}
Console.WriteLine("Received Publish" + "Name: " + name + "eventTopic: " + e.getTopic() + " " + e.getNumber());
if (!(name.StartsWith("broker")))
{
sendToPM("PubEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
propagate(e);
sentToSub(name, e);
return "ACK";
}
示例4: floodNoOrder
public void floodNoOrder(Event e)
{
Console.WriteLine("Flooding Started");
string lastHop = e.getLastHop();
e.setLastHop(this.myUrl);
if (lastHop.Equals("null"))
{
if (! (parentURL.Equals("null")))
{
IBroker parent = (IBroker)Activator.GetObject(
typeof(IBroker),
this.parentURL);
parent.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
if (!(childs.Count == 0))
{
foreach (string childurl in childs.Values)
{
IBroker child = (IBroker)Activator.GetObject(
typeof(IBroker),
childurl);
child.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
}
}
else
{
if (!(this.parentURL.Equals("null")) && !(this.parentURL.Equals(lastHop)))
{
IBroker parent = (IBroker)Activator.GetObject(
typeof(IBroker),
this.parentURL);
parent.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
if (!(childs.Count == 0))
{
foreach (string childurl in childs.Values)
{
if (!(childurl.Equals(lastHop)))
{
IBroker child = (IBroker)Activator.GetObject(
typeof(IBroker),
childurl);
child.receivePub(e.getSender(), e);
sendToPM("BroEvent " + name + " , " + e.getSender() + " , " + e.getTopic() + " , " + e.getNumber());
}
}
}
}
}
示例5: floodFiltered
public void floodFiltered(Event e)
{
//ok stop it right
string lastHop = e.getLastHop();
e.setLastHop(this.myUrl);
foreach (KeyValuePair<string,string> kvp in filteringInterest)
{
//&& kvp.Value.Equals(this.myUrl)
if (kvp.Key.Equals(e.getTopic()))
{
if (!lastHop.Equals(kvp.Value))
{
Console.WriteLine("Filtering to:" + kvp.Value);
IBroker broker = (IBroker)Activator.GetObject(
typeof(IBroker),
kvp.Value);
broker.receivePub(e.getSender(),e);
}
}
}
}
示例6: receiveEvent
public void receiveEvent(string name, Event e)
{
if (isFrozen)
{
FrozenEvent fe = new FrozenEvent("EVENT", e);
frozenEvents.Add(fe);
return;
}
this.eventsReceived.Add(new KeyValuePair<string, Event>(name, e));
Console.WriteLine("Evento Recebido de "+e.getSender()+" sobre " + e.getTopic()+" EventNumber : "+e.getNumber());
}