private async Task <DbConnection> GetConnection(ConnectionName connectionName, ConnectionIntent intent)
        {
            ApplicationIntent applicationIntent;

            switch (intent)
            {
            case ConnectionIntent.ReadOnly:
                applicationIntent = ApplicationIntent.ReadOnly;
                break;

            case ConnectionIntent.ReadWrite:
                applicationIntent = ApplicationIntent.ReadWrite;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(intent), $"{intent} is not a valid value for {typeof(ConnectionIntent)}");
            }
            var conn = await OpenConnection(connectionName, applicationIntent).ConfigureAwait(false);

            if (_storeConnections)
            {
                _dbConnections.Push(conn);
            }
            return(conn);
        }
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default)
        {
            if (Disabled != null && Disabled.GetValue(dc.State))
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            // Update the dialog options with the runtime settings.
            DialogOptions.BotId                 = BotId.GetValue(dc.State);
            DialogOptions.SkillHostEndpoint     = new Uri(SkillHostEndpoint.GetValue(dc.State));
            DialogOptions.ConversationIdFactory = dc.Context.TurnState.Get <SkillConversationIdFactoryBase>() ?? throw new NullReferenceException("Unable to locate SkillConversationIdFactoryBase in HostContext");
            DialogOptions.SkillClient           = dc.Context.TurnState.Get <BotFrameworkClient>() ?? throw new NullReferenceException("Unable to locate BotFrameworkClient in HostContext");
            DialogOptions.ConversationState     = dc.Context.TurnState.Get <ConversationState>() ?? throw new NullReferenceException($"Unable to get an instance of {nameof(ConversationState)} from TurnState.");
            DialogOptions.ConnectionName        = ConnectionName.GetValue(dc.State);

            // Set the skill to call
            DialogOptions.Skill.Id            = DialogOptions.Skill.AppId = SkillAppId.GetValue(dc.State);
            DialogOptions.Skill.SkillEndpoint = new Uri(SkillEndpoint.GetValue(dc.State));

            // Store the initialized DialogOptions in state so we can restore these values when the dialog is resumed.
            dc.ActiveDialog.State[_dialogOptionsStateKey] = DialogOptions;

            // Get the activity to send to the skill.
            Activity activity = null;

            if (Activity != null && ActivityProcessed.GetValue(dc.State))
            {
                // The parent consumed the activity in context, use the Activity property to start the skill.
                activity = await Activity.BindAsync(dc, cancellationToken : cancellationToken).ConfigureAwait(false);
            }

            // Call the base to invoke the skill
            // (If the activity has not been processed, send the turn context activity to the skill (pass through)).
            return(await base.BeginDialogAsync(dc, new BeginSkillDialogOptions { Activity = activity ?? dc.Context.Activity }, cancellationToken).ConfigureAwait(false));
        }
Beispiel #3
0
 public ConnectionDescription(ComponentPoint start, ComponentPoint end, ConnectionEdge edge, ConnectionName name)
 {
     Start = start;
     End   = end;
     Edge  = edge;
     Name  = name;
 }
 public async Task InvokeOnConnection(ConnectionName connectionName, ConnectionIntent intent,
                                      Func <DbConnection, Task> action)
 {
     using (var connection = await GetConnection(connectionName, intent))
     {
         await action(connection);
     }
 }
 public async Task <T> InvokeOnConnection <T>(ConnectionName connectionName, ConnectionIntent intent,
                                              Func <DbConnection, Task <T> > func)
 {
     using (var connection = await GetConnection(connectionName, intent))
     {
         return(await func(connection));
     }
 }
Beispiel #6
0
        /// <summary>
        /// Signs out the user.
        /// </summary>
        /// <param name="dc">DialogContext for the current turn of conversation with the user.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A task that represents the work queued to execute.</returns>
        public async Task SignOutUserAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken))
        {
            var settings = new OAuthPromptSettings {
                ConnectionName = ConnectionName?.GetValue(dc.State)
            };

            await new OAuthPrompt(nameof(OAuthPrompt), settings).SignOutUserAsync(dc.Context, cancellationToken).ConfigureAwait(false);
        }
Beispiel #7
0
        /// <summary>
        /// Attempts to get the user's token.
        /// </summary>
        /// <param name="dc">DialogContext for the current turn of conversation with the user.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A task that represents the work queued to execute.</returns>
        /// <remarks>If the task is successful and user already has a token or the user successfully signs in,
        /// the result contains the user's token.</remarks>
        public async Task <TokenResponse> GetUserTokenAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken))
        {
            var settings = new OAuthPromptSettings {
                ConnectionName = ConnectionName?.GetValue(dc.State)
            };

            return(await new OAuthPrompt(nameof(OAuthPrompt), settings).GetUserTokenAsync(dc.Context, cancellationToken).ConfigureAwait(false));
        }
        private Task SendOAuthCardAsync(DialogContext dc, IMessageActivity prompt, CancellationToken cancellationToken)
        {
            var settings = new OAuthPromptSettings {
                ConnectionName = ConnectionName?.GetValue(dc.State), Title = Title?.GetValue(dc.State), Text = Text?.GetValue(dc.State)
            };

            return(OAuthPrompt.SendOAuthCardAsync(settings, dc.Context, prompt, cancellationToken));
        }
        private Task <PromptRecognizerResult <TokenResponse> > RecognizeTokenAsync(DialogContext dc, CancellationToken cancellationToken)
        {
            var settings = new OAuthPromptSettings {
                ConnectionName = ConnectionName.GetValue(dc.State)
            };

            return(OAuthPrompt.RecognizeTokenAsync(settings, dc, cancellationToken));
        }
Beispiel #10
0
 public Connection(ConnectionName name, IAmAnInputChannel channel, Type dataType, int noOfPerformers, int timeoutInMilliseconds)
 {
     Name = name;
     Channel = channel;
     DataType = dataType;
     NoOfPeformers = noOfPerformers;
     TimeoutInMiliseconds = timeoutInMilliseconds;
 }
Beispiel #11
0
        /// <summary>
        /// Attempts to get the user's token.
        /// </summary>
        /// <param name="dc">DialogContext for the current turn of conversation with the user.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A task that represents the work queued to execute.</returns>
        /// <remarks>If the task is successful and user already has a token or the user successfully signs in,
        /// the result contains the user's token.</remarks>
        public async Task <TokenResponse> GetUserTokenAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (!(dc.Context.Adapter is IUserTokenProvider adapter))
            {
                throw new InvalidOperationException("OAuthPrompt.GetUserToken(): not supported by the current adapter");
            }

            return(await adapter.GetUserTokenAsync(dc.Context, ConnectionName.GetValue(dc.State), null, cancellationToken).ConfigureAwait(false));
        }
 /// <summary>Snippet for GetConnection</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetConnectionResourceNames()
 {
     // Create client
     ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.Create();
     // Initialize request argument(s)
     ConnectionName name = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]");
     // Make the request
     Connection response = connectionServiceClient.GetConnection(name);
 }
Beispiel #13
0
        /// <summary>
        /// Signs out the user.
        /// </summary>
        /// <param name="dc">DialogContext for the current turn of conversation with the user.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A task that represents the work queued to execute.</returns>
        public async Task SignOutUserAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (!(dc.Context.Adapter is IUserTokenProvider adapter))
            {
                throw new InvalidOperationException("OAuthPrompt.SignOutUser(): not supported by the current adapter");
            }

            // Sign out user
            await adapter.SignOutUserAsync(dc.Context, ConnectionName.GetValue(dc.State), dc.Context.Activity?.From?.Id, cancellationToken).ConfigureAwait(false);
        }
        private async Task <DbConnection> OpenConnection(ConnectionName name, ApplicationIntent applicationIntent)
        {
            _loggingService.Debug($"Getting connection {name}:{applicationIntent}");
            var connStr = await ResolveConnString(name.ToString(), applicationIntent).Caf();

            var cnn = new SqlConnection(connStr);

            cnn.Open();
            return(cnn);
        }
        /// <summary>Snippet for DeleteConnectionAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteConnectionResourceNamesAsync()
        {
            // Create client
            ConnectionServiceClient connectionServiceClient = await ConnectionServiceClient.CreateAsync();

            // Initialize request argument(s)
            ConnectionName name = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]");
            // Make the request
            await connectionServiceClient.DeleteConnectionAsync(name);
        }
        /// <summary>
        /// Called when the dialog is started and pushed onto the dialog stack.
        /// </summary>
        /// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param>
        /// <param name="options">Optional, initial information to pass to the dialog.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects
        /// or threads to receive notice of cancellation.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default)
        {
            if (options is CancellationToken)
            {
                throw new ArgumentException($"{nameof(options)} cannot be a cancellation token");
            }

            if (!(dc.Context.Adapter is IExtendedUserTokenProvider tokenProvider))
            {
                throw new InvalidOperationException($"{Kind}: not supported by the current adapter");
            }

            if (Disabled != null && Disabled.GetValue(dc.State) == true)
            {
                return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            var connectionName = ConnectionName.GetValueOrNull(dc.State);

            if (string.IsNullOrEmpty(connectionName))
            {
                throw new InvalidOperationException($"A valid {nameof(ConnectionName)} is required for {Kind}.");
            }

            var title = Title.GetValueOrNull(dc.State);

            if (string.IsNullOrEmpty(title))
            {
                throw new InvalidOperationException($"A valid {nameof(Title)} is required for {Kind}.");
            }

            var tokenResponse = await GetUserTokenAsync(dc, tokenProvider, connectionName, cancellationToken).ConfigureAwait(false);

            if (tokenResponse != null && !string.IsNullOrEmpty(tokenResponse.Token))
            {
                // we have the token, so the user is already signed in.
                // Similar to OAuthInput, just return the token in the property.
                if (Property != null)
                {
                    dc.State.SetValue(Property.GetValue(dc.State), tokenResponse);
                }

                // End the dialog and return the token response
                return(await dc.EndDialogAsync(tokenResponse, cancellationToken : cancellationToken).ConfigureAwait(false));
            }

            // There is no token, so the user has not signed in yet.
            var activity = await GetInvokeResponseWithSignInLinkAsync(dc, title, tokenProvider, connectionName, cancellationToken).ConfigureAwait(false);

            await dc.Context.SendActivityAsync(activity, cancellationToken : cancellationToken).ConfigureAwait(false);

            // Since a token was not retrieved above, end the turn.
            return(Dialog.EndOfTurn);
        }
Beispiel #17
0
 public XmlConnectionDescription(
     ConnectionName name,
     XmlComponentPoint start,
     XmlComponentPoint end,
     ConditionalCollection <ConnectionEdge> edge)
 {
     Name  = name;
     Start = start;
     End   = end;
     Edge  = edge;
 }
 /// <summary>Snippet for UpdateConnection</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void UpdateConnectionResourceNames()
 {
     // Create client
     ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.Create();
     // Initialize request argument(s)
     ConnectionName name       = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]");
     Connection     connection = new Connection();
     FieldMask      updateMask = new FieldMask();
     // Make the request
     Connection response = connectionServiceClient.UpdateConnection(name, connection, updateMask);
 }
        private async Task SendOAuthCardAsync(DialogContext dc, IMessageActivity prompt, CancellationToken cancellationToken)
        {
            var title = await Title.GetValueAsync(dc, cancellationToken).ConfigureAwait(false);

            var text = await Text.GetValueAsync(dc, cancellationToken).ConfigureAwait(false);

            var settings = new OAuthPromptSettings {
                ConnectionName = ConnectionName?.GetValue(dc.State), Title = title, Text = text
            };
            await OAuthPrompt.SendOAuthCardAsync(settings, dc.Context, prompt, cancellationToken).ConfigureAwait(false);
        }
 /// <summary>Snippet for GetConnection</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetConnectionRequestObject()
 {
     // Create client
     ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.Create();
     // Initialize request argument(s)
     GetConnectionRequest request = new GetConnectionRequest
     {
         ConnectionName = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]"),
     };
     // Make the request
     Connection response = connectionServiceClient.GetConnection(request);
 }
Beispiel #21
0
        /// <summary>Snippet for DeleteConnection</summary>
        public void DeleteConnectionResourceNames()
        {
            // Snippet: DeleteConnection(ConnectionName, CallSettings)
            // Create client
            ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.Create();
            // Initialize request argument(s)
            ConnectionName name = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]");

            // Make the request
            connectionServiceClient.DeleteConnection(name);
            // End snippet
        }
Beispiel #22
0
        public async Task Test()
        {
            var userId = "1";
            var user   = new UserTest(userId)
            {
                Name = new List <IMessagePart> {
                    Common.MessagePartFactory.CreateMessageText("name1")
                },
            };
            var serverMock  = new Mock <IDataSource>();
            var server      = serverMock.Object;
            var loggerMock  = new Mock <ILogger>();
            var logger      = loggerMock.Object;
            var optionsMock = new Mock <IOptions>();
            var options     = optionsMock.Object;

            var metadataMock = new Mock <IMessageMetadata>();

            metadataMock.Setup(m => m.User).Returns(user);
            var methodsMock = new Mock <IMessageMethods>();

            var metadata         = metadataMock.Object;
            var methods          = methodsMock.Object;
            var connectionName   = new ConnectionName();
            var connectionStatus = new Mock <IConnectionStatus>().Object;
            var siteOptionsMock  = new Mock <INicoSiteOptions>();

            siteOptionsMock.Setup(s => s.IsAutoSetNickname).Returns(true);
            var siteOptions = siteOptionsMock.Object;

            var userInfoMock = new Mock <IUserInfo>();
            var userInfo     = userInfoMock.Object;

            var chat1    = new Chat("<chat thread=\"1645724171\" no=\"4\" vpos=\"180000\" date=\"1550890471\" date_usec=\"549074\" mail=\"184\" user_id=\"G-lRat9seQmpK-gcgcQXSFxr14c\" premium=\"1\" anonymity=\"1\" locale=\"ja-jp\">message1</chat>");
            var comment1 = await Tools.CreateNicoComment(chat1, user, siteOptions, "", userid => Task.FromResult(userInfo), logger) as INicoComment;

            var cvm1 = new NicoCommentViewModel(comment1, metadata, methods, connectionStatus, options);

            Assert.IsNull(cvm1.NameItems);

            var chat2    = new Chat("<chat thread=\"1645724171\" no=\"4\" vpos=\"180000\" date=\"1550890471\" date_usec=\"549074\" mail=\"184\" user_id=\"G-lRat9seQmpK-gcgcQXSFxr14c\" premium=\"1\" anonymity=\"1\" locale=\"ja-jp\">message2@newnick</chat>");
            var comment2 = await Tools.CreateNicoComment(chat2, user, siteOptions, "", userid => Task.FromResult(userInfo), logger) as INicoComment;

            var cvm2 = new NicoCommentViewModel(comment2, metadata, methods, connectionStatus, options);

            Assert.AreEqual(new List <IMessagePart> {
                Common.MessagePartFactory.CreateMessageText("newnick")
            }, cvm1.NameItems);
            Assert.AreEqual(new List <IMessagePart> {
                Common.MessagePartFactory.CreateMessageText("newnick")
            }, cvm2.NameItems);
        }
Beispiel #23
0
        /// <summary>Snippet for DeleteConnectionAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteConnectionRequestObjectAsync()
        {
            // Create client
            ConnectionServiceClient connectionServiceClient = await ConnectionServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteConnectionRequest request = new DeleteConnectionRequest
            {
                ConnectionName = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]"),
            };
            // Make the request
            await connectionServiceClient.DeleteConnectionAsync(request);
        }
Beispiel #24
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Protocol != null ? Protocol.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TopicName != null ? TopicName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (QueueName != null ? QueueName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubscriptionName != null ? SubscriptionName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ConnectionName != null ? ConnectionName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Durable.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #25
0
        /// <summary>Snippet for DeleteConnectionAsync</summary>
        public async Task DeleteConnectionResourceNamesAsync()
        {
            // Snippet: DeleteConnectionAsync(ConnectionName, CallSettings)
            // Additional: DeleteConnectionAsync(ConnectionName, CancellationToken)
            // Create client
            ConnectionServiceClient connectionServiceClient = await ConnectionServiceClient.CreateAsync();

            // Initialize request argument(s)
            ConnectionName name = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]");
            // Make the request
            await connectionServiceClient.DeleteConnectionAsync(name);

            // End snippet
        }
Beispiel #26
0
 /// <summary>Snippet for UpdateConnection</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void UpdateConnectionRequestObject()
 {
     // Create client
     ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.Create();
     // Initialize request argument(s)
     UpdateConnectionRequest request = new UpdateConnectionRequest
     {
         ConnectionName = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]"),
         Connection     = new Connection(),
         UpdateMask     = new FieldMask(),
     };
     // Make the request
     Connection response = connectionServiceClient.UpdateConnection(request);
 }
Beispiel #27
0
        public void TestRegisterTransientClass()
        {
            var container = new IocContainer();

            container.Register(typeof(ConnectionName));

            ConnectionName connectionName = (ConnectionName)container.Resolve(typeof(ConnectionName));

            Assert.NotNull(connectionName);

            ConnectionName connectionName2 = (ConnectionName)container.Resolve(typeof(ConnectionName));

            Assert.NotNull(connectionName);
            Assert.NotEqual(connectionName, connectionName2);
        }
Beispiel #28
0
        public void TestRegisterSingletonClassGeneric()
        {
            var container = new IocContainer();

            container.Register <ConnectionName>(LifestyleType.Singleton);

            ConnectionName connectionName = container.Resolve <ConnectionName>();

            Assert.NotNull(connectionName);

            ConnectionName connectionName2 = container.Resolve <ConnectionName>();

            Assert.NotNull(connectionName);
            Assert.Equal(connectionName, connectionName2);
        }
Beispiel #29
0
        /// <summary>Snippet for DeleteConnection</summary>
        public void DeleteConnectionRequestObject()
        {
            // Snippet: DeleteConnection(DeleteConnectionRequest, CallSettings)
            // Create client
            ConnectionServiceClient connectionServiceClient = ConnectionServiceClient.Create();
            // Initialize request argument(s)
            DeleteConnectionRequest request = new DeleteConnectionRequest
            {
                ConnectionName = ConnectionName.FromProjectLocationConnection("[PROJECT]", "[LOCATION]", "[CONNECTION]"),
            };

            // Make the request
            connectionServiceClient.DeleteConnection(request);
            // End snippet
        }
Beispiel #30
0
        public void TestRegisterSingletonClass()
        {
            var container = new IocContainer();

            container.Register(typeof(ConnectionName), LifestyleType.Singleton);

            ConnectionName connectionName = (ConnectionName)container.Resolve(typeof(ConnectionName));

            Assert.NotNull(connectionName);

            ConnectionName connectionName2 = (ConnectionName)container.Resolve(typeof(ConnectionName));

            Assert.NotNull(connectionName);
            Assert.Equal(connectionName, connectionName2);
        }
Beispiel #31
0
        public void TestRegisterTransientClassGeneric()
        {
            var container = new IocContainer();

            container.Register <ConnectionName>();

            ConnectionName connectionName = container.Resolve <ConnectionName>();

            Assert.NotNull(connectionName);

            ConnectionName connectionName2 = container.Resolve <ConnectionName>();

            Assert.NotNull(connectionName);
            Assert.NotEqual(connectionName, connectionName2);
        }
Beispiel #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Connection"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="channelFactory">The channel factory to create channels for Consumer</param>
 /// <param name="dataType">Type of the data.</param>
 /// <param name="routingKey">The routing key</param>
 /// <param name="noOfPerformers">The no of performers.</param>
 /// <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
 /// <param name="requeueCount">The number of times you want to requeue a message before dropping it</param>
 /// <param name="requeueDelayInMilliseconds">The number of milliseconds to delay the delivery of a requeue message for</param>
 /// <param name="unacceptableMessageLimit">The number of unacceptable messages to handle, before stopping reading from the channel</param>
 /// <param name="channelName">The channel name</param>
 /// <param name="isDurable">The durability of the queue</param>
 public Connection(ConnectionName name, IAmAChannelFactory channelFactory, Type dataType, ChannelName channelName, string routingKey, int noOfPerformers = 1, int timeoutInMilliseconds = 300, int requeueCount = -1, int requeueDelayInMilliseconds = 0, int unacceptableMessageLimit = 0, bool isDurable = false)
 {
     RequeueCount = requeueCount;
     Name = name;
     ChannelFactory = channelFactory;
     DataType = dataType;
     NoOfPeformers = noOfPerformers;
     TimeoutInMiliseconds = timeoutInMilliseconds;
     UnacceptableMessageLimit = unacceptableMessageLimit;
     RequeueDelayInMilliseconds = requeueDelayInMilliseconds;
     ChannelName = channelName;
     RoutingKey = routingKey;
     IsDurable = isDurable;
 }
Beispiel #33
0
 public RunningConsumer(ConnectionName connectionName, ConsumerState state)
 {
     ConnectionName = connectionName;
     State = state;
 }
Beispiel #34
0
 public Consumer(ConnectionName name, IAmAnInputChannel channel, IAmAMessagePump messagePump)
 {
     Name = name;
     Performer = new Performer(channel, messagePump);
     State = ConsumerState.Shut;
 }