public static void SendRequestStartedNotification(String clientId, Guid requestId, String requestPath, Uri requestUri, Byte tileSize, DateTime submissionTime) { ChannelFactory <INotificationChannel> channelFactory = null; INotificationChannel channel = null; try { channelFactory = GetChannelFactory(clientId); channel = channelFactory.CreateChannel(); channel.Open(); channel.NotifyRequestStarted(requestId, requestPath, requestUri, tileSize, submissionTime); } catch (Exception e) { Trace.TraceError("Client: {0}{4}Exception: {1}{4}Message: {2}{4}Trace: {3}", clientId, e.GetType(), e.Message, e.StackTrace, Environment.NewLine); } finally { if ((channel != null) && (channel.State == CommunicationState.Opened)) { channel.Close(); } if ((channelFactory != null) && (channelFactory.State == CommunicationState.Opened)) { channelFactory.Close(); } } }
public InAppNotificationsAdminController(INotificationChannel notificationChannel, IUserSessions sessions, InAppNotificationRepository repository, ILogger logger) { _notificationChannel = notificationChannel; _sessions = sessions; _repository = repository; _logger = logger; }
public NotifyReceiptChannelModule(INotificationChannel notificationChannel) { if (notificationChannel == null) { throw new ArgumentNullException(nameof(notificationChannel)); } _notificationChannel = notificationChannel; }
public NotificationBusTests() { notificationChannel1 = Substitute.For <INotificationChannel>(); notificationChannel1.NotificationTypes.Returns(new[] { typeof(Notification1) }); notificationChannel2 = Substitute.For <INotificationChannel>(); notificationChannel2.NotificationTypes.Returns(new[] { typeof(Notification2) }); sut = new NotificationBus(new[] { notificationChannel1, notificationChannel2 }); }
public static SurrogateForINotificationChannel Convert(INotificationChannel value) { if (value == null) { return(null); } return(new SurrogateForINotificationChannel()); }
public GameFinderConfigService( IConfiguration config, INotificationChannel notificationChannel) { _notificationChannel = notificationChannel; config.SettingsChanged += (s, c) => ApplyConfig(c); ApplyConfig(config.Settings); }
/// <summary> /// Asynchronously sends a notification to the queue. /// </summary> /// <param name="account">The account to send the notification to.</param> /// <param name="notification">A notification to send.</param> /// <returns>The task.</returns> public Task SendAsync <TAccountKey>(NotificationAccount <TAccountKey> account, Notification notification) { Throw.IfArgumentNull(account, nameof(account)); Throw.IfArgumentNull(notification, nameof(notification)); INotificationChannel channel = this.channelFactory.GetChannel(notification); return(channel.SendAsync(account, notification)); }
public static bool OverrideReceiver(INotificationChannel channel, ICanTell receiver) { var akkaChannel = channel as AkkaReceiverNotificationChannel; if (akkaChannel != null) { akkaChannel.Receiver = receiver; return true; } else { return false; } }
public static SurrogateForINotificationChannel Convert(INotificationChannel value) { if (value == null) { return(null); } var actor = (IActorRef)(((AkkaReceiverNotificationChannel)value).Receiver); return(new SurrogateForINotificationChannel { Actor = actor }); }
public AbstractMessageProcessor( INotificationChannel <T> notificationChannel, IStorageProvider <T> storageProvider, IStorageMessageSerializer messageSerializer, ITransactionTracker <T> transactionTracker, IAsbtractMqFactory <T> mqFactory) { _notificationChannel = notificationChannel ?? throw new ArgumentNullException(nameof(notificationChannel)); _storageProvider = storageProvider ?? throw new ArgumentNullException(nameof(storageProvider)); _messageSerializer = messageSerializer ?? throw new ArgumentNullException(nameof(messageSerializer)); _transactionTracker = transactionTracker ?? throw new ArgumentNullException(nameof(transactionTracker)); _mqFactory = mqFactory ?? throw new ArgumentNullException(nameof(mqFactory)); }
public static bool OverrideReceiver(INotificationChannel channel, ICanTell receiver) { var akkaChannel = channel as AkkaReceiverNotificationChannel; if (akkaChannel != null) { akkaChannel.Receiver = receiver; return(true); } else { return(false); } }
public async Task ItShouldNotCommitNotificationsIfReceivedAnEmptyCollectionOfNotifications( INotificationChannel <long> channel, AbstractMessageProcessor <long> sut) { // Arrange A.CallTo(() => channel.Receive(A <CancellationToken> ._)) .Returns(Enumerable.Empty <INotification <long> >().ToArray()); // Act await sut.GetMessages(CancellationToken.None); // Assert A.CallTo(() => channel.Commit(A <INotification <long>[]> ._, A <NotificationTransaction> ._)) .MustNotHaveHappened(); }
private NotificationScheduler <Guid> CreateScheduler(NotificationTest test, out INotificationChannel channel) { channel = Substitute.For <INotificationChannel>(); NotificationChannelFactory factory = new NotificationChannelFactory(); factory.RegisterChannel <PushNotification>(channel); return (new NotificationScheduler <Guid>( new NotificationQueue(factory), new NotificationAccountManager <Guid>(test.NotificationAccountRepository), test.NotificationRepository, test.EventPublisher)); }
public async Task ItShouldStoreTheExpectedMessagesWhenNoExceptionIsThrown( [Frozen] IStorageProvider <long> storageProvider, [Frozen] IStorageMessageSerializer serializer, CancellationToken cancellation, NotificationTransaction expectedTransaction, INotification <long>[] expectedNotifications, INotificationChannel <long> channel, AbstractMessageProcessor <long> sut) { // Arrange // Act await sut.GetMessages(cancellation); // Assert A.CallTo(() => storageProvider.Store(serializer, expectedNotifications)).MustHaveHappened(Repeated.Exactly.Once) .Then(A.CallTo(() => channel.Commit(expectedNotifications, expectedTransaction)).MustHaveHappened(Repeated.Exactly.Once)); }
public async Task ItShouldReturnTheExpectedResultsIfReceivedAnEmptyCollectionOfNotifications( INotificationChannel <long> channel, AbstractMessageProcessor <long> sut) { // Arrange A.CallTo(() => channel.Receive(A <CancellationToken> ._)) .Returns(Enumerable.Empty <INotification <long> >().ToArray()); var likeness = new MessageEnvelope(null, null) .AsSource() .OfLikeness <MessageEnvelope>(); // Act var actual = await sut.GetMessages(CancellationToken.None); // Assert likeness.ShouldEqual(actual); }
public async Task ItShouldRollbackTheExpectedMessagesWhenAnExceptionIsThrown( [Frozen] IStorageProvider <long> storageProvider, NotificationTransaction expectedTransaction, INotification <long>[] expectedNotifications, INotificationChannel <long> channel, AbstractMessageProcessor <long> sut) { // Arrange A.CallTo(() => storageProvider.Store( A <IStorageMessageSerializer> ._, A <INotification <long>[]> ._)) .Throws <Exception>(); // Act await sut.GetMessages(CancellationToken.None); // Assert A.CallTo(() => channel.Commit(A <INotification <long>[]> ._, A <NotificationTransaction> ._)).MustNotHaveHappened(); A.CallTo(() => channel.Rollback(expectedNotifications, expectedTransaction)).MustHaveHappened(Repeated.Exactly.Once); }
public void RegisterNotificationChannel(INotificationChannel channel) // a public method to provide access to the _notificationChannels private field { _notificationChannels.Add(channel); }
public void RegistorNotificationChannel(INotificationChannel notificationChannel) { _notificationChannels.Add(notificationChannel); }
public UserPairingObserver(INotificationChannel channel, int observerId = 0) : base(channel, observerId) { }
public static void Notify(INotificationChannel channel, INotificationReceiver receiver, NotificationContent content) { channel.Notify(receiver, content); }
public NotificationChannelController(INotificationChannel channel) { this.channel = channel; }
public ActorBoundChannelObserver(INotificationChannel channel, int observerId = 0) : base(channel, observerId) { }
public void RegisterNotificationService(INotificationChannel channel) { _lstNotifications.Add(channel); }
public SubscriptionMessage(INotificationChannel notificationChannel, SubscriptionId subscriptionId, IEventMatcher eventMatcher) { NotificationChannel = notificationChannel; SubscriptionId = subscriptionId; EventMatcher = eventMatcher; }
public static SurrogateForINotificationChannel Convert(INotificationChannel value) { if (value == null) return null; var actor = (IActorRef)(((AkkaReceiverNotificationChannel)value).Receiver); return new SurrogateForINotificationChannel { Actor = actor }; }
public HomeController(ILogger <HomeController> logger, INotificationChannel notificationChannel) { _logger = logger; _notificationChannel = notificationChannel; }
public void RegistrationNotification(INotificationChannel channel) { _notificationChannel.Add(channel); }
protected InterfacedObserver(INotificationChannel channel, int observerId) { Channel = channel; ObserverId = observerId; }
public GreetObserver(INotificationChannel channel, int observerId = 0) : base(channel, observerId) { }
public void RegisterNotificationChannels(INotificationChannel notificationChannel) { _inotificationChannels.Add(notificationChannel); }
public void RegisterNotificationChannel(INotificationChannel channel) { _notificationChannels.Add(channel); }
/// <summary> /// Registers a channel for a specific type of notification. /// </summary> /// <param name="channel">A channel to register.</param> public void RegisterChannel <TNotification>(INotificationChannel channel) where TNotification : Notification { this.RegisterChannel <TNotification>(() => channel); }
public static SurrogateForINotificationChannel Convert(INotificationChannel value) { if (value == null) return null; return new SurrogateForINotificationChannel(); }
public ProductionStepsChangedUseCase(INotificationChannel channel) { _channel = channel; }