Exemplo n.º 1
0
        public SqsMessageConsumerRequeueTests()
        {
            _myCommand = new MyCommand {
                Value = "Test"
            };
            _correlationId = Guid.NewGuid();
            _replyTo       = "http:\\queueUrl";
            _contentType   = "text\\plain";
            _topicName     = _myCommand.GetType().FullName.ToString().ToValidSNSTopicName();

            _message = new Message(
                new MessageHeader(_myCommand.Id, _topicName, MessageType.MT_COMMAND, _correlationId, _replyTo, _contentType),
                new MessageBody(JsonConvert.SerializeObject(_myCommand))
                );

            //Must have credentials stored in the SDK Credentials store or shared credentials file
            if (new CredentialProfileStoreChain().TryGetAWSCredentials("default", out var credentials))
            {
                var awsConnection = new AWSMessagingGatewayConnection(credentials, RegionEndpoint.EUWest1);

                _channelFactory = new InputChannelFactory(awsConnection, new SqsMessageConsumerFactory(awsConnection));
                _channel        = _channelFactory.CreateInputChannel(new Connection <MyCommand>());

                _messageProducer = new SqsMessageProducer(awsConnection);
            }
        }
Exemplo n.º 2
0
        public SqsQueuePurgeTests()
        {
            MyCommand myCommand = new MyCommand {
                Value = "Test"
            };

            _message = new Message(
                new MessageHeader(myCommand.Id, "MyCommand", MessageType.MT_COMMAND),
                new MessageBody(JsonConvert.SerializeObject(myCommand))
                );

            //Must have credentials stored in the SDK Credentials store or shared credentials file
            if (new CredentialProfileStoreChain().TryGetAWSCredentials("default", out var credentials))
            {
                var awsConnection = new AWSMessagingGatewayConnection(credentials, RegionEndpoint.EUWest1);

                _channelFactory = new InputChannelFactory(awsConnection, new SqsMessageConsumerFactory(awsConnection));
                _channel        = _channelFactory.CreateInputChannel(new Connection <MyCommand>());

                _messageProducer = new SqsMessageProducer(awsConnection);
            }
        }