Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandleSendNotificationProtocol"/> class.
        /// </summary>
        /// <param name="eventStream">The Notification Event Stream.</param>
        /// <param name="sagaStream">The Notification Saga Stream.</param>
        /// <param name="getAudienceProtocol">Executes a <see cref="GetAudienceOp"/>.</param>
        /// <param name="getDeliveryChannelConfigsProtocol">Executes a <see cref="GetDeliveryChannelConfigsOp"/>.</param>
        /// <param name="prepareToSendOnChannelProtocol">Executes a <see cref="PrepareToSendOnChannelOp"/>.</param>
        /// <param name="cannotPrepareToSendOnChannelAction">Specifies what to do when we encounter a situation where we cannot prepare to send on a channel.</param>
        /// <param name="channelToOperationStreamMap">A map of delivery channel to the channel's operation stream.</param>
        /// <param name="buildSendNotificationRequestedEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="SendNotificationRequestedEvent"/> into the Notification Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        /// <param name="buildCouldNotGetOrUseAudienceEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="CouldNotGetOrUseAudienceEvent"/> into the Notification Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        /// <param name="buildCouldNotGetOrUseDeliveryChannelConfigsEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="CouldNotGetOrUseDeliveryChannelConfigsEvent"/> into the Notification Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        /// <param name="buildPrepareToSendNotificationEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="PrepareToSendNotificationEventBase"/> into the Notification Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        /// <param name="buildExecuteProcessSendNotificationSagaEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="ProcessSendNotificationSagaOp"/> into the Notification Saga Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        public HandleSendNotificationProtocol(
            IWriteOnlyStream eventStream,
            IWriteOnlyStream sagaStream,
            IGetAudienceProtocol getAudienceProtocol,
            IGetDeliveryChannelConfigsProtocol getDeliveryChannelConfigsProtocol,
            IPrepareToSendOnChannelProtocol prepareToSendOnChannelProtocol,
            CannotPrepareToSendOnChannelAction cannotPrepareToSendOnChannelAction,
            IReadOnlyDictionary <IDeliveryChannel, IWriteOnlyStream> channelToOperationStreamMap,
            IBuildTagsProtocol <SendNotificationRequestedEvent> buildSendNotificationRequestedEventTagsProtocol = null,
            IBuildTagsProtocol <CouldNotGetOrUseAudienceEvent> buildCouldNotGetOrUseAudienceEventTagsProtocol   = null,
            IBuildTagsProtocol <CouldNotGetOrUseDeliveryChannelConfigsEvent> buildCouldNotGetOrUseDeliveryChannelConfigsEventTagsProtocol = null,
            IBuildTagsProtocol <PrepareToSendNotificationEventBase> buildPrepareToSendNotificationEventTagsProtocol = null,
            IBuildTagsProtocol <ExecuteOpRequestedEvent <long, ProcessSendNotificationSagaOp> > buildExecuteProcessSendNotificationSagaEventTagsProtocol = null)
        {
            new { eventStream }.AsArg().Must().NotBeNull();
            new { sagaStream }.AsArg().Must().NotBeNull();
            new { getAudienceProtocol }.AsArg().Must().NotBeNull();
            new { getDeliveryChannelConfigsProtocol }.AsArg().Must().NotBeNull();
            new { prepareToSendOnChannelProtocol }.AsArg().Must().NotBeNull();
            new { cannotPrepareToSendOnChannelAction }.AsArg().Must().NotBeEqualTo(CannotPrepareToSendOnChannelAction.Unknown);
            new { channelToOperationStreamMap }.AsArg().Must().NotBeNullNorEmptyDictionaryNorContainAnyNullValues();

            this.eventStream         = eventStream;
            this.sagaStream          = sagaStream;
            this.getAudienceProtocol = getAudienceProtocol;
            this.getDeliveryChannelConfigsProtocol  = getDeliveryChannelConfigsProtocol;
            this.prepareToSendOnChannelProtocol     = prepareToSendOnChannelProtocol;
            this.cannotPrepareToSendOnChannelAction = cannotPrepareToSendOnChannelAction;
            this.channelToOperationStreamMap        = channelToOperationStreamMap;
            this.buildSendNotificationRequestedEventTagsProtocol = buildSendNotificationRequestedEventTagsProtocol;
            this.buildCouldNotGetOrUseAudienceEventTagsProtocol  = buildCouldNotGetOrUseAudienceEventTagsProtocol;
            this.buildCouldNotGetOrUseDeliveryChannelConfigsEventTagsProtocol = buildCouldNotGetOrUseDeliveryChannelConfigsEventTagsProtocol;
            this.buildPrepareToSendNotificationEventTagsProtocol          = buildPrepareToSendNotificationEventTagsProtocol;
            this.buildExecuteProcessSendNotificationSagaEventTagsProtocol = buildExecuteProcessSendNotificationSagaEventTagsProtocol;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SendNotificationProtocol"/> class.
        /// </summary>
        /// <param name="clientOperationStream">The client operation stream.</param>
        /// <param name="buildExecuteSendNotificationEventTagsProtocol">OPTIONAL protocol that executes a <see cref="BuildTagsOp{TEvent}"/>.  DEFAULT is null (no tags added when putting operation into stream).</param>
        public SendNotificationProtocol(
            IWriteOnlyStream clientOperationStream,
            IBuildTagsProtocol <ExecuteOpRequestedEvent <long, SendNotificationOp> > buildExecuteSendNotificationEventTagsProtocol = null)
        {
            new { clientOperationStream }.AsArg().Must().NotBeNull();

            this.clientOperationStream = clientOperationStream;
            this.buildExecuteSendNotificationEventTagsProtocol = buildExecuteSendNotificationEventTagsProtocol;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandleProcessSendNotificationSagaProtocol"/> class.
        /// </summary>
        /// <param name="notificationEventStream">The event stream.</param>
        /// <param name="channelToEventStreamMap">A map of delivery channel to the channel's event stream.</param>
        /// <param name="buildAttemptToSendNotificationEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="AttemptToSendNotificationEventBase"/> into the Notification Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        public HandleProcessSendNotificationSagaProtocol(
            IWriteOnlyStream notificationEventStream,
            IReadOnlyDictionary <IDeliveryChannel, IReadOnlyStream> channelToEventStreamMap,
            IBuildTagsProtocol <AttemptToSendNotificationEventBase> buildAttemptToSendNotificationEventTagsProtocol = null)
        {
            new { notificationEventStream }.AsArg().Must().NotBeNull();
            new { channelToEventStreamMap }.AsArg().Must().NotBeNullNorEmptyDictionaryNorContainAnyNullValues();

            this.notificationEventStream = notificationEventStream;
            this.channelToEventStreamMap = channelToEventStreamMap;
            this.buildAttemptToSendNotificationEventTagsProtocol = buildAttemptToSendNotificationEventTagsProtocol;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HandleUploadFileToSlackProtocol"/> class.
        /// </summary>
        /// <param name="uploadFileToSlackProtocol">Protocol to upload a file to Slack.</param>
        /// <param name="slackEventStream">The Slack event stream.</param>
        /// <param name="buildUploadFileToSlackRequestedEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="UploadFileToSlackRequestedEvent{TId}"/> into the Email Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        /// <param name="buildUploadFileToSlackResponseEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="UploadFileToSlackResponseEventBase{TId}"/> into the Email Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        public HandleUploadFileToSlackProtocol(
            IUploadFileToSlackProtocol uploadFileToSlackProtocol,
            IWriteOnlyStream slackEventStream,
            IBuildTagsProtocol <UploadFileToSlackRequestedEvent <long> > buildUploadFileToSlackRequestedEventTagsProtocol   = null,
            IBuildTagsProtocol <UploadFileToSlackResponseEventBase <long> > buildUploadFileToSlackResponseEventTagsProtocol = null)
        {
            new { uploadFileToSlackProtocol }.AsArg().Must().NotBeNull();
            new { slackEventStream }.AsArg().Must().NotBeNull();

            this.uploadFileToSlackProtocol = uploadFileToSlackProtocol;
            this.slackEventStream          = slackEventStream;
            this.buildUploadFileToSlackRequestedEventTagsProtocol = buildUploadFileToSlackRequestedEventTagsProtocol;
            this.buildUploadFileToSlackResponseEventTagsProtocol  = buildUploadFileToSlackResponseEventTagsProtocol;
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandleSendEmailProtocol"/> class.
        /// </summary>
        /// <param name="sendEmailProtocol">Protocol to send an email.</param>
        /// <param name="emailEventStream">The email event stream.</param>
        /// <param name="buildSendEmailRequestedEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="SendEmailRequestedEvent{TId}"/> into the Email Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        /// <param name="buildSendEmailResponseEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="SendEmailResponseEventBase{TId}"/> into the Email Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        public HandleSendEmailProtocol(
            ISendEmailProtocol sendEmailProtocol,
            IWriteOnlyStream emailEventStream,
            IBuildTagsProtocol <SendEmailRequestedEvent <long> > buildSendEmailRequestedEventTagsProtocol   = null,
            IBuildTagsProtocol <SendEmailResponseEventBase <long> > buildSendEmailResponseEventTagsProtocol = null)
        {
            new { sendEmailProtocol }.AsArg().Must().NotBeNull();
            new { emailEventStream }.AsArg().Must().NotBeNull();

            this.sendEmailProtocol = sendEmailProtocol;
            this.emailEventStream  = emailEventStream;
            this.buildSendEmailRequestedEventTagsProtocol = buildSendEmailRequestedEventTagsProtocol;
            this.buildSendEmailResponseEventTagsProtocol  = buildSendEmailResponseEventTagsProtocol;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HandleSendSlackMessageProtocol"/> class.
        /// </summary>
        /// <param name="sendSlackMessageProtocol">Protocol to send a slack message.</param>
        /// <param name="slackEventStream">The Slack event stream.</param>
        /// <param name="buildSendSlackMessageRequestedEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="SendSlackMessageRequestedEvent{TId}"/> into the Email Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        /// <param name="buildSendSlackMessageResponseEventTagsProtocol">OPTIONAL protocol to builds the tags to use when putting the <see cref="SendSlackMessageResponseEventBase{TId}"/> into the Email Event Stream.  DEFAULT is to not add any tags; tags will be null.  Consider using <see cref="UseInheritableTagsProtocol{TEvent}"/> to just use the inheritable tags.</param>
        public HandleSendSlackMessageProtocol(
            ISendSlackMessageProtocol sendSlackMessageProtocol,
            IWriteOnlyStream slackEventStream,
            IBuildTagsProtocol <SendSlackMessageRequestedEvent <long> > buildSendSlackMessageRequestedEventTagsProtocol   = null,
            IBuildTagsProtocol <SendSlackMessageResponseEventBase <long> > buildSendSlackMessageResponseEventTagsProtocol = null)
        {
            new { sendSlackMessageProtocol }.AsArg().Must().NotBeNull();
            new { slackEventStream }.AsArg().Must().NotBeNull();

            this.sendSlackMessageProtocol = sendSlackMessageProtocol;
            this.slackEventStream         = slackEventStream;
            this.buildSendSlackMessageRequestedEventTagsProtocol = buildSendSlackMessageRequestedEventTagsProtocol;
            this.buildSendSlackMessageResponseEventTagsProtocol  = buildSendSlackMessageResponseEventTagsProtocol;
        }