本文整理汇总了C#中ISubscriber.Subscribe方法的典型用法代码示例。如果您正苦于以下问题:C# ISubscriber.Subscribe方法的具体用法?C# ISubscriber.Subscribe怎么用?C# ISubscriber.Subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISubscriber
的用法示例。
在下文中一共展示了ISubscriber.Subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LunchFilter
public LunchFilter(IFiber fiber,
ISubscriber<SimpleYouTubeClip> input,
IPublisher<SimpleYouTubeClip> output)
{
this.output = output;
this.subscription = input.Subscribe(fiber, NewClip);
}
示例2: MainWindow
public MainWindow(ISubscriber<PlayerCommand> commandChannel, IPublisher<RichYouTubeClip> finishedChannel)
{
InitializeComponent();
this.finishedChannel = finishedChannel;
finishedTimer = new Timer(TimerExpired);
progressTimer = new System.Timers.Timer(1000);
progressTimer.AutoReset = true;
progressTimer.Elapsed += new System.Timers.ElapsedEventHandler(progressTimer_Elapsed);
var fiber = new DispatcherFiber(Dispatcher);
commandChannel.Subscribe(fiber, OnPlayerCommand);
fiber.Start();
WindowStyle = WindowStyle.None;
WindowState = WindowState.Maximized;
ShowInTaskbar = false;
Cursor = Cursors.None;
try
{
tv.Initialize();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error initialize remote control", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
示例3: WarmUp
protected override Task WarmUp()
{
return Task.Run(() =>
{
_subscriber = _connectionMultiplexerFunc().GetSubscriber();
_subscriber.Subscribe(_redisKey, OnNotificationReceived);
}).ConfigureAwaitFalse();
}
示例4: PlaylistController
public PlaylistController(IFiber fiber,
ISubscriber<RichYouTubeClip> newClips,
ISubscriber<RichYouTubeClip> finishedPlaying,
IPublisher<PlayerCommand> playerCommands)
{
this.playerCommands = playerCommands;
this.newClipSubscription = newClips.Subscribe(fiber, NewClip);
this.finishedSubscription = finishedPlaying.Subscribe(fiber, Finished);
}
示例5: RedisConnection
public RedisConnection(IDatabase redis, ISubscriber subscriber, string jobStorageIdentity)
{
_subscriber = subscriber;
_jobStorageIdentity = jobStorageIdentity;
Redis = redis;
mre = new ManualResetEvent(false);
_subscriber.Subscribe(string.Format("{0}JobFetchChannel", RedisStorage.Prefix), (channel, val) => { mre.Set();});
}
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
sub = redis.GetSubscriber();
sub.Subscribe("message", (channel, message) =>
{
messageList.Add((string)message);
System.Diagnostics.Trace.Write((string)message);
});
}
示例7: RedisSubscribe
public RedisSubscribe(ISubscriber Subscriber, string Prefix)
{
Channel = Prefix + "announce";
_Subscriber = Subscriber;
_Event = new ManualResetEvent(false);
_Subscriber.Subscribe(Channel, delegate
{
_Event.Set();
});
}
示例8: FibonacciCalculator
public FibonacciCalculator(ThreadFiber fiber, string name,
ISubscriber<IntPair> inboundChannel,
IChannel<IntPair> outboundChannel,
int limit)
{
_threadFiber = fiber;
_name = name;
_inboundChannel = inboundChannel;
_outboundChannel = outboundChannel;
_inboundChannel.Subscribe(fiber, CalculateNext);
_limit = limit;
}
示例9: YouTubeInfoDownloader
public YouTubeInfoDownloader(IFiber fiber, ISubscriber<SimpleYouTubeClip> simpleChannel, IPublisher<RichYouTubeClip> richChannel)
{
this.richChannel = richChannel;
this.subscription = simpleChannel.Subscribe(fiber, EnrichYouTubeClip);
}
示例10: EventStoreEmbeddedNodeConnection
public EventStoreEmbeddedNodeConnection(ConnectionSettings settings, string connectionName, IPublisher publisher, ISubscriber bus, IAuthenticationProvider authenticationProvider)
{
Ensure.NotNull(publisher, "publisher");
Ensure.NotNull(settings, "settings");
Guid connectionId = Guid.NewGuid();
_settings = settings;
_connectionName = connectionName;
_publisher = publisher;
_authenticationProvider = authenticationProvider;
_subscriptionBus = new InMemoryBus("Embedded Client Subscriptions");
_subscriptions = new EmbeddedSubscriber(_subscriptionBus, _authenticationProvider, _settings.Log, connectionId);
_subscriptionBus.Subscribe<ClientMessage.SubscriptionConfirmation>(_subscriptions);
_subscriptionBus.Subscribe<ClientMessage.SubscriptionDropped>(_subscriptions);
_subscriptionBus.Subscribe<ClientMessage.StreamEventAppeared>(_subscriptions);
_subscriptionBus.Subscribe<ClientMessage.PersistentSubscriptionConfirmation>(_subscriptions);
_subscriptionBus.Subscribe<ClientMessage.PersistentSubscriptionStreamEventAppeared>(_subscriptions);
_subscriptionBus.Subscribe(new AdHocHandler<ClientMessage.SubscribeToStream>(_publisher.Publish));
_subscriptionBus.Subscribe(new AdHocHandler<ClientMessage.UnsubscribeFromStream>(_publisher.Publish));
_subscriptionBus.Subscribe(new AdHocHandler<ClientMessage.ConnectToPersistentSubscription>(_publisher.Publish));
bus.Subscribe(new AdHocHandler<SystemMessage.BecomeShutdown>(_ => Disconnected(this, new ClientConnectionEventArgs(this, new IPEndPoint(IPAddress.None, 0)))));
}
示例11: SubscribeMainBus
private static void SubscribeMainBus(
ISubscriber mainBus,
ProjectionManager projectionManager,
ProjectionType runProjections,
ProjectionManagerResponseReader projectionManagerResponseReader,
IODispatcher ioDispatcher,
ProjectionManagerCommandWriter projectionManagerCommandWriter)
{
mainBus.Subscribe<SystemMessage.StateChangeMessage>(projectionManager);
mainBus.Subscribe<SystemMessage.SystemCoreReady>(projectionManager);
if (runProjections >= ProjectionType.System)
{
mainBus.Subscribe<ProjectionManagementMessage.Command.Post>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.UpdateQuery>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.GetQuery>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.Delete>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.GetStatistics>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.GetState>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.GetResult>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.Disable>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.Enable>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.Abort>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.SetRunAs>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.Reset>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Command.StartSlaveProjections>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.Started>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.Stopped>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.Faulted>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.Prepared>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.StateReport>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.ResultReport>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.StatisticsReport>(projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(projectionManager);
mainBus.Subscribe<CoreProjectionStatusMessage.ProjectionWorkerStarted>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.ReaderReady>(projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Starting>(projectionManagerResponseReader);
}
mainBus.Subscribe<ClientMessage.WriteEventsCompleted>(projectionManager);
mainBus.Subscribe<ClientMessage.DeleteStreamCompleted>(projectionManager);
mainBus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(projectionManager);
mainBus.Subscribe(ioDispatcher.Awaker);
mainBus.Subscribe(ioDispatcher.BackwardReader);
mainBus.Subscribe(ioDispatcher.ForwardReader);
mainBus.Subscribe(ioDispatcher.StreamDeleter);
mainBus.Subscribe(ioDispatcher.Writer);
mainBus.Subscribe(ioDispatcher);
mainBus.Subscribe<ProjectionManagementMessage.Starting>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.CreatePrepared>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepareSlave>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.LoadStopped>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.Start>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.Stop>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.Kill>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.Dispose>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.GetState>(projectionManagerCommandWriter);
mainBus.Subscribe<CoreProjectionManagementMessage.GetResult>(projectionManagerCommandWriter);
mainBus.Subscribe<ProjectionManagementMessage.SlaveProjectionsStarted>(projectionManagerCommandWriter);
}
示例12: SetupMessaging
public void SetupMessaging(ISubscriber mainBus)
{
mainBus.Subscribe<SystemMessage.StateChangeMessage>(_projectionManager);
if (_runProjections >= RunProjections.System)
{
mainBus.Subscribe<ProjectionManagementMessage.Post>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.UpdateQuery>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.GetQuery>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Delete>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.GetStatistics>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.GetState>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.GetResult>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Disable>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Enable>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Abort>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.SetRunAs>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Reset>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.StartSlaveProjections>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Internal.RegularTimeout>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(_projectionManager);
mainBus.Subscribe<ProjectionManagementMessage.RegisterSystemProjection>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.Started>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.Stopped>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.Faulted>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.Prepared>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.StateReport>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.ResultReport>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_projectionManager);
mainBus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(_projectionManager);
}
mainBus.Subscribe<ClientMessage.WriteEventsCompleted>(_projectionManager);
mainBus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_projectionManager);
}
示例13: SolvedQuadraticSink
public SolvedQuadraticSink(IFiber fiber, ISubscriber<SolvedQuadratic> solvedChannel, int numberToOutput)
{
_fiber = fiber;
_numberToOutput = numberToOutput;
solvedChannel.Subscribe(fiber, PrintSolution);
}
示例14: QuadraticSolver
public QuadraticSolver(IFiber fiber, ISubscriber<Quadratic> channel, IChannel<SolvedQuadratic> solvedChannel)
{
_solvedChannel = solvedChannel;
channel.Subscribe(fiber, ProcessReceivedQuadratic);
}
示例15: LinkExtractor
public LinkExtractor(IFiber fiber, ISubscriber<MailMessage> messageChannel, IPublisher<SimpleYouTubeClip> clipChannel)
{
this.clipChannel = clipChannel;
this.subscription = messageChannel.Subscribe(fiber, HandleMessage);
}