本文整理汇总了C#中Akka.Event.EventStream类的典型用法代码示例。如果您正苦于以下问题:C# EventStream类的具体用法?C# EventStream怎么用?C# EventStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventStream类属于Akka.Event命名空间,在下文中一共展示了EventStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DefaultDispatcherPrerequisites
/// <summary>
/// Default constructor...
/// </summary>
public DefaultDispatcherPrerequisites(EventStream eventStream, IScheduler scheduler, Settings settings, Mailboxes mailboxes)
{
Mailboxes = mailboxes;
Settings = settings;
Scheduler = scheduler;
EventStream = eventStream;
}
开发者ID:Micha-kun,项目名称:akka.net,代码行数:10,代码来源:AbstractDispatcher.cs
示例2: ClusterActorRefProvider
public ClusterActorRefProvider(string systemName, Settings settings, EventStream eventStream /*DynamicAccess*/)
: base(systemName, settings, eventStream)
{
var clusterConfig = ClusterConfigFactory.Default();
settings.InjectTopLevelFallback(clusterConfig);
Deployer = new ClusterDeployer(settings);
}
开发者ID:njimenez,项目名称:akka.net,代码行数:7,代码来源:ClusterActorRefProvider.cs
示例3: EventStreamUnsubscriber
public EventStreamUnsubscriber(EventStream eventStream, ActorSystem system, bool debug)
{
_eventStream = eventStream;
_system = system;
_debug = debug;
}
开发者ID:Micha-kun,项目名称:akka.net,代码行数:7,代码来源:EventBusUnsubscriber.cs
示例4: PreStart
protected override void PreStart()
{
base.PreStart();
_self = Self;
_eventStream = Context.System.EventStream;
// create initial actors and bind them
if (_initiator.CreateInitialActors != null)
{
var actors = _initiator.CreateInitialActors(Context, _connection);
if (actors != null)
{
foreach (var actor in actors)
{
BindActor(actor.Item1, actor.Item2.Select(t => new BoundType(t)));
}
}
}
// accept it
_connection.MessageHandler = OnConnectionMessage;
_connection.Approve();
}
开发者ID:SaladLab,项目名称:Akka.Interfaced.SlimSocket,代码行数:26,代码来源:UdpChannel.cs
示例5: NotAllowNullAsSubscriber
public void NotAllowNullAsSubscriber()
{
var bus = new EventStream(true);
XAssert.Throws<ArgumentNullException>(() =>
{
bus.Subscribe(null, typeof(M));
});
}
开发者ID:skotzko,项目名称:akka.net,代码行数:8,代码来源:EventStreamSpec.cs
示例6: PhiAccrualFailureDetector
/// <summary>
/// Constructor that reads parameters from config.
/// Expecting config properties named 'threshold', 'max-sample-size',
/// 'min-std-deviation', 'acceptable-heartbeat-pause', and 'heartbeat-interval'.
/// </summary>
public PhiAccrualFailureDetector(Config config, EventStream ev)
: this(DefaultClock)
{
_threshold = config.GetDouble("threshold");
_maxSampleSize = config.GetInt("max-sample-size");
_minStdDeviation = config.GetTimeSpan("min-std-deviation");
_acceptableHeartbeatPause = config.GetTimeSpan("acceptable-heartbeat-pause");
_firstHeartbeatEstimate = config.GetTimeSpan("heartbeat-interval");
state = new State(FirstHeartBeat, null);
}
开发者ID:Micha-kun,项目名称:akka.net,代码行数:15,代码来源:PhiAccrualFailureDetector.cs
示例7: ManageSubscriptions
public void ManageSubscriptions()
{
var bus = new EventStream(true);
bus.Subscribe(TestActor, typeof(M));
bus.Publish(new M { Value = 42 });
ExpectMsg(new M { Value = 42 });
bus.Unsubscribe(TestActor);
bus.Publish(new M { Value = 43 });
ExpectNoMsg(TimeSpan.FromSeconds(1));
}
开发者ID:njimenez,项目名称:akka.net,代码行数:11,代码来源:EventStreamSpec.cs
示例8: NotAllowNullAsUnsubscriber
public void NotAllowNullAsUnsubscriber()
{
var bus = new EventStream(true);
intercept<ArgumentNullException>(() =>
{
bus.Unsubscribe(null, typeof(M));
});
intercept<ArgumentNullException>(() =>
{
bus.Unsubscribe(null);
});
}
开发者ID:rmiller1971,项目名称:akka.net,代码行数:12,代码来源:EventStreamSpec.cs
示例9: PreStart
protected override void PreStart()
{
base.PreStart();
_self = Self;
_eventStream = Context.System.EventStream;
// create initial actors and bind them
if (_initiator.CreateInitialActors != null)
{
var actors = _initiator.CreateInitialActors(Context, _connection);
if (actors != null)
{
foreach (var actor in actors)
{
BindActor(actor.Item1, actor.Item2.Select(t => new BoundType(t)));
}
}
}
// link connection to this
_connection.Closed += OnConnectionClose;
_connection.Received += OnConnectionReceive;
if (_connection.IsOpen == false)
{
try
{
_connection.Open();
}
catch (Exception e)
{
_logger.ErrorFormat("Cannot open connection.", e);
}
}
else
{
if (_connection.Active)
{
_connection.Send(new Packet
{
Type = PacketType.System,
Message = "1",
});
}
else
{
OnConnectionClose(_connection, -1);
}
}
}
开发者ID:SaladLab,项目名称:Akka.Interfaced.SlimSocket,代码行数:53,代码来源:TcpChannel.cs
示例10: ManageSubscriptions
public void ManageSubscriptions()
{
var bus = new EventStream(true);
bus.StartUnsubscriber(Sys.AsInstanceOf<ActorSystemImpl>());
bus.Subscribe(TestActor, typeof(M));
bus.Publish(new M { Value = 42 });
ExpectMsg(new M { Value = 42 });
bus.Unsubscribe(TestActor);
bus.Publish(new M { Value = 43 });
ExpectNoMsg(TimeSpan.FromSeconds(1));
}
开发者ID:skotzko,项目名称:akka.net,代码行数:13,代码来源:EventStreamSpec.cs
示例11: PreStart
protected override void PreStart()
{
base.PreStart();
_self = Self;
_eventStream = Context.System.EventStream;
_connection.Closed += OnConnectionClose;
_connection.Received += OnConnectionReceive;
_connection.Open();
if (_initiator.TokenTimeout != TimeSpan.Zero)
{
_timeoutCanceler = Context.System.Scheduler.ScheduleTellOnceCancelable(
_initiator.TokenTimeout, Self, PoisonPill.Instance, Self);
}
}
开发者ID:SaladLab,项目名称:Akka.Interfaced.SlimSocket,代码行数:17,代码来源:TokenChecker.cs
示例12: LocalActorRefProvider
public LocalActorRefProvider(string systemName, Settings settings, EventStream eventStream, Deployer deployer, Func<ActorPath, InternalActorRef> deadLettersFactory)
{
_settings = settings;
_eventStream = eventStream;
_deployer = deployer ?? new Deployer(settings);
_rootPath = new RootActorPath(new Address("akka", systemName));
_log = Logging.GetLogger(eventStream, "LocalActorRefProvider(" + _rootPath.Address + ")");
if (deadLettersFactory == null)
deadLettersFactory = p => new DeadLetterActorRef(this, p, _eventStream);
_deadLetters = deadLettersFactory(_rootPath / "deadLetters");
_tempNumber = new AtomicCounterLong(1);
_tempNode = _rootPath / "temp";
//TODO: _guardianSupervisorStrategyConfigurator = dynamicAccess.createInstanceFor[SupervisorStrategyConfigurator](settings.SupervisorStrategyClass, EmptyImmutableSeq).get
_systemGuardianStrategy = SupervisorStrategy.DefaultStrategy;
}
开发者ID:ClusterReply,项目名称:akka.net,代码行数:17,代码来源:LocalActorRefProvider.cs
示例13: ManageSubChannelsUsingClasses
public void ManageSubChannelsUsingClasses()
{
var a = new A();
var b1 = new B1();
var b2 = new B2();
var c = new C();
var bus = new EventStream(false);
bus.Subscribe(TestActor, typeof(B2));
bus.Publish(c);
bus.Publish(b2);
ExpectMsg(b2);
bus.Subscribe(TestActor, typeof(A));
bus.Publish(c);
ExpectMsg(c);
bus.Publish(b1);
ExpectMsg(b1);
bus.Unsubscribe(TestActor, typeof(B1));
bus.Publish(c); //should not publish
bus.Publish(b2); //should publish
bus.Publish(a); //should publish
ExpectMsg(b2);
ExpectMsg(a);
ExpectNoMsg(TimeSpan.FromSeconds(1));
}
开发者ID:skotzko,项目名称:akka.net,代码行数:25,代码来源:EventStreamSpec.cs
示例14: FailureDetectorPuppet
public FailureDetectorPuppet(Config config, EventStream ev)
{
}
开发者ID:rodrigovidal,项目名称:akka.net,代码行数:3,代码来源:FailureDetectorPuppet.cs
示例15: DeadLetterActorRef
public DeadLetterActorRef(IActorRefProvider provider, ActorPath path, EventStream eventStream)
: base(provider, path, eventStream)
{
_eventStream = eventStream;
}
开发者ID:njimenez,项目名称:akka.net,代码行数:5,代码来源:BuiltInActors.cs
示例16: EmptyLocalActorRef
public EmptyLocalActorRef(IActorRefProvider provider, ActorPath path, EventStream eventStream)
{
_provider = provider;
_path = path;
_eventStream = eventStream;
}
开发者ID:MaciekLesiczka,项目名称:akka.net,代码行数:6,代码来源:EmptyLocalActorRef.cs
示例17: LocalActorRefProvider
public LocalActorRefProvider(string systemName, Settings settings, EventStream eventStream)
: this(systemName, settings, eventStream, null, null)
{
//Intentionally left blank
}
开发者ID:rogeralsing,项目名称:akka.net,代码行数:5,代码来源:ActorRefProvider.cs
示例18: DeadLetterActorRef
/// <summary>
/// Initializes a new instance of the <see cref="DeadLetterActorRef" /> class.
/// </summary>
/// <param name="provider">The provider.</param>
/// <param name="path">The path.</param>
/// <param name="eventStream">The event stream.</param>
public DeadLetterActorRef(ActorRefProvider provider, ActorPath path, EventStream eventStream)
{
this.eventStream = eventStream;
this.path = path;
this.provider = provider;
}
开发者ID:Badmoonz,项目名称:akka.net,代码行数:12,代码来源:BuiltInActors.cs
示例19: ManageSubChannelsUsingClassesAndInterfacesUpdateOnUnsubscribeAll
public void ManageSubChannelsUsingClassesAndInterfacesUpdateOnUnsubscribeAll()
{
var es = new EventStream(false);
var tm1 = new CC();
var tm2 = new CCATBT();
var a1 = TestProbe();
var a2 = TestProbe();
var a3 = TestProbe();
var a4 = TestProbe();
es.Subscribe(a1.Ref, typeof(AT)).Then(Assert.True);
es.Subscribe(a2.Ref, typeof(BT)).Then(Assert.True);
es.Subscribe(a3.Ref, typeof(CC)).Then(Assert.True);
es.Subscribe(a4.Ref, typeof(CCATBT)).Then(Assert.True);
es.Unsubscribe(a3.Ref).Then(Assert.True);
es.Publish(tm1);
es.Publish(tm2);
a1.expectMsg(tm2);
a2.expectMsg(tm2);
a3.expectNoMsg(TimeSpan.FromSeconds(1));
a4.expectMsg(tm2);
es.Unsubscribe(a1.Ref, typeof(AT)).Then(Assert.True);
es.Unsubscribe(a2.Ref, typeof(BT)).Then(Assert.True);
es.Unsubscribe(a3.Ref, typeof(CC)).Then(Assert.False);
es.Unsubscribe(a4.Ref, typeof(CCATBT)).Then(Assert.True);
}
开发者ID:rmiller1971,项目名称:akka.net,代码行数:26,代码来源:EventStreamSpec.cs
示例20: ManageLogLevels
public void ManageLogLevels()
{
var bus = new EventStream(false);
bus.StartDefaultLoggers(sys);
bus.Publish(new SetTarget(testActor));
expectMsg("OK");
verifyLevel(bus, LogLevel.InfoLevel);
bus.SetLogLevel(LogLevel.WarningLevel);
verifyLevel(bus, LogLevel.WarningLevel);
bus.SetLogLevel(LogLevel.DebugLevel);
verifyLevel(bus, LogLevel.DebugLevel);
bus.SetLogLevel(LogLevel.ErrorLevel);
verifyLevel(bus, LogLevel.ErrorLevel);
}
开发者ID:Badmoonz,项目名称:akka.net,代码行数:16,代码来源:EventStreamSpec.cs
注:本文中的Akka.Event.EventStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论