public void SetUp() { var configuration = new ConnectionConfiguration { Hosts = new List<IHostConfiguration> { new HostConfiguration { Host = "localhost", Port = 5672 } }, UserName = "******", Password = "******" }; configuration.Validate(); var typeNameSerializer = new TypeNameSerializer(); connectionFactory = new ConnectionFactoryWrapper(configuration, new DefaultClusterHostSelectionStrategy<ConnectionFactoryInfo>()); serializer = new JsonSerializer(typeNameSerializer); conventions = new Conventions(typeNameSerializer); consumerErrorStrategy = new DefaultConsumerErrorStrategy( connectionFactory, serializer, new ConsoleLogger(), conventions, typeNameSerializer); }
public AdvancedAutoSubscriber(string subscriptionIdPrefix, IBus bus, IConventions conventions) : base(bus, subscriptionIdPrefix) { this.conventions = conventions; advancedBus = bus.Advanced; SubscriptionConfiguration = (configuration, subscriber) => { }; }
public NackConsumerErrorStrategy( IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions, ITypeNameSerializer typeNameSerializer) : base(connectionFactory, serializer, logger, conventions, typeNameSerializer) { }
public CustomErrorStrategy( EasyNetQ.IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions, ITypeNameSerializer typeNameSerializer) { this.connectionFactory = connectionFactory; this.serializer = serializer; this.logger = logger; this.conventions = conventions; this.typeNameSerializer = typeNameSerializer; }
public MessageBusConsumerErrorStrategy( string errorExchangeName, IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions) : base(connectionFactory, serializer, logger, conventions) { _errorExchangeName = errorExchangeName; _connectionFactory = connectionFactory; _serializer = serializer; _logger = logger; }
public DefaultConsumerErrorStrategy( IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions) { Preconditions.CheckNotNull(conventions, "conventions"); this.connectionFactory = connectionFactory; this.serializer = serializer; this.logger = logger; this.conventions = conventions; }
public DefaultConsumerErrorStrategy( IConnectionFactory connectionFactory, ISerializer serializer, IConventions conventions) { Preconditions.CheckNotNull(conventions, "conventions"); logger = Application.Current.LoggerProvider.GetLogger(RabbitMessageBus.MessageBusLoggerName); this.connectionFactory = connectionFactory; this.serializer = serializer; //this.logger = logger; this.conventions = conventions; }
private async Task<IExchange> DeclareVersionedExchangesAsync(IAdvancedBus advancedBus, IConventions conventions, MessageVersionStack messageVersions, string exchangeType) { IExchange destinationExchange = null; while (! messageVersions.IsEmpty()) { var messageType = messageVersions.Pop(); var exchangeName = conventions.ExchangeNamingConvention(messageType); var sourceExchange = await DeclareExchangeAsync(advancedBus, exchangeName, exchangeType).ConfigureAwait(false); if (destinationExchange != null) { await advancedBus.BindAsync(sourceExchange, destinationExchange, "#").ConfigureAwait(false); } destinationExchange = sourceExchange; } return destinationExchange; }
public MyErrorStrategy( IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions) { // Preconditions.CheckNotNull(connectionFactory, "connectionFactory"); // Preconditions.CheckNotNull(serializer, "serializer"); // Preconditions.CheckNotNull(logger, "logger"); // Preconditions.CheckNotNull(conventions, "conventions"); this.connectionFactory = connectionFactory; this.serializer = serializer; this.logger = logger; this.conventions = conventions; }
public DefaultConsumerErrorStrategy( IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions) { if (conventions == null) { throw new ArgumentNullException("conventions"); } this.connectionFactory = connectionFactory; this.serializer = serializer; this.logger = logger; this.conventions = conventions; }
private Task<IExchange> DeclareVersionedExchanges(IAdvancedBus advancedBus, IConventions conventions, MessageVersionStack messageVersions, string exchangeType) { var destinationExchangeTask = TaskHelpers.FromResult<IExchange>(null); while (! messageVersions.IsEmpty()) { var messageType = messageVersions.Pop(); var exchangeName = conventions.ExchangeNamingConvention(messageType); destinationExchangeTask = destinationExchangeTask.Then(destinationExchange => DeclareExchangeAsync(advancedBus, exchangeName, exchangeType).Then(sourceExchange => { if (destinationExchange != null) return advancedBus.BindAsync(sourceExchange, destinationExchange, "#").Then(() => sourceExchange); return TaskHelpers.FromResult(sourceExchange); })); } return destinationExchangeTask; }
public Program( ArgParser argParser, IQueueRetreival queueRetreival, IMessageWriter messageWriter, IMessageReader messageReader, IQueueInsertion queueInsertion, IErrorRetry errorRetry, IConventions conventions) { this.argParser = argParser; this.queueRetreival = queueRetreival; this.messageWriter = messageWriter; this.messageReader = messageReader; this.queueInsertion = queueInsertion; this.errorRetry = errorRetry; this.conventions = conventions; }
private IExchange DeclareVersionedExchanges( IAdvancedBus advancedBus, IConventions conventions, MessageVersionStack messageVersions, string exchangeType ) { // This works because the message version stack is LIFO from most superseded message type to the actual message type IExchange destinationExchange = null; while( !messageVersions.IsEmpty() ) { var messageType = messageVersions.Pop(); var exchangeName = conventions.ExchangeNamingConvention( messageType ); var sourceExchange = DeclareExchange( advancedBus, exchangeName, exchangeType ); if( destinationExchange != null ) advancedBus.Bind( sourceExchange, destinationExchange, "#" ); destinationExchange = sourceExchange; } return destinationExchange; }
public InternalConsumer( IHandlerRunner handlerRunner, IEasyNetQLogger logger, IConsumerDispatcher consumerDispatcher, IConventions conventions, IConnectionConfiguration connectionConfiguration) { Preconditions.CheckNotNull(handlerRunner, "handlerRunner"); Preconditions.CheckNotNull(logger, "logger"); Preconditions.CheckNotNull(consumerDispatcher, "consumerDispatcher"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration"); this.handlerRunner = handlerRunner; this.logger = logger; this.consumerDispatcher = consumerDispatcher; this.conventions = conventions; this.connectionConfiguration = connectionConfiguration; }
public DefaultConsumerErrorStrategy( IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions, ITypeNameSerializer typeNameSerializer) { Preconditions.CheckNotNull(connectionFactory, "connectionFactory"); Preconditions.CheckNotNull(serializer, "serializer"); Preconditions.CheckNotNull(logger, "logger"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(typeNameSerializer, "typeNameSerializer"); this.connectionFactory = connectionFactory; this.serializer = serializer; this.logger = logger; this.conventions = conventions; this.typeNameSerializer = typeNameSerializer; }
public InternalConsumerFactory( IHandlerRunner handlerRunner, IEasyNetQLogger logger, IConventions conventions, ConnectionConfiguration connectionConfiguration, IConsumerDispatcherFactory consumerDispatcherFactory, IEventBus eventBus) { Preconditions.CheckNotNull(handlerRunner, "handlerRunner"); Preconditions.CheckNotNull(logger, "logger"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration"); Preconditions.CheckNotNull(consumerDispatcherFactory, "consumerDispatcherFactory"); this.handlerRunner = handlerRunner; this.logger = logger; this.conventions = conventions; this.connectionConfiguration = connectionConfiguration; this.consumerDispatcherFactory = consumerDispatcherFactory; this.eventBus = eventBus; }
/// <summary> /// Creates RabbitAdvancedBus /// </summary> public RabbitAdvancedBus( IPersistentConnection connection, IConsumerFactory consumerFactory, IClientCommandDispatcher clientCommandDispatcher, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IServiceResolver container, ConnectionConfiguration configuration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, IPullingConsumerFactory pullingConsumerFactory, AdvancedBusEventHandlers advancedBusEventHandlers ) { Preconditions.CheckNotNull(connection, "connection"); Preconditions.CheckNotNull(consumerFactory, "consumerFactory"); Preconditions.CheckNotNull(eventBus, "eventBus"); Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory"); Preconditions.CheckNotNull(container, "container"); Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy"); Preconditions.CheckNotNull(configuration, "configuration"); Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(pullingConsumerFactory, "pullingConsumerFactory"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); this.connection = connection; this.consumerFactory = consumerFactory; this.clientCommandDispatcher = clientCommandDispatcher; this.confirmationListener = confirmationListener; this.eventBus = eventBus; this.handlerCollectionFactory = handlerCollectionFactory; this.Container = container; this.configuration = configuration; this.produceConsumeInterceptor = produceConsumeInterceptor; this.messageSerializationStrategy = messageSerializationStrategy; this.pullingConsumerFactory = pullingConsumerFactory; this.Conventions = conventions; if (advancedBusEventHandlers.Connected != null) { Connected += advancedBusEventHandlers.Connected; } if (advancedBusEventHandlers.Disconnected != null) { Disconnected += advancedBusEventHandlers.Disconnected; } if (advancedBusEventHandlers.Blocked != null) { Blocked += advancedBusEventHandlers.Blocked; } if (advancedBusEventHandlers.Unblocked != null) { Unblocked += advancedBusEventHandlers.Unblocked; } if (advancedBusEventHandlers.MessageReturned != null) { MessageReturned += advancedBusEventHandlers.MessageReturned; } eventSubscriptions = new[] { this.eventBus.Subscribe <ConnectionCreatedEvent>(OnConnectionCreated), this.eventBus.Subscribe <ConnectionRecoveredEvent>(OnConnectionRecovered), this.eventBus.Subscribe <ConnectionDisconnectedEvent>(OnConnectionDisconnected), this.eventBus.Subscribe <ConnectionBlockedEvent>(OnConnectionBlocked), this.eventBus.Subscribe <ConnectionUnblockedEvent>(OnConnectionUnblocked), this.eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned), }; }
public MessageReaderTests() { conventions = new Conventions(new LegacyTypeNameSerializer()); messageReader = new MessageReader(); }
/// <summary> /// Sets the convention to be used with the command. Only conventions applied to the root command are used. /// </summary> /// <param name="conventions"></param> /// <returns></returns> public Command Use(IConventions conventions) { _conventions = conventions; return(this); }
public ElasticApmAdvancedBus(IConnectionFactory connectionFactory, IConsumerFactory consumerFactory, IClientCommandDispatcherFactory clientCommandDispatcherFactory, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IServiceResolver container, ConnectionConfiguration connectionConfiguration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, AdvancedBusEventHandlers advancedBusEventHandlers, IPersistentConnectionFactory persistentConnectionFactory, ILogProvider logProvider) : base(connectionFactory, consumerFactory, clientCommandDispatcherFactory, confirmationListener, eventBus, handlerCollectionFactory, container, connectionConfiguration, produceConsumeInterceptor, messageSerializationStrategy, conventions, advancedBusEventHandlers, persistentConnectionFactory) { }
public void TestResourceTypeBuilderCreateResourceType(string name, IResourceTypeFactory resourceTypeFactory, IConventions conventions, IResourceType expectedResourceType, IEnumerable <IComplexType> complexTypes) { this.Output.WriteLine("Test Name: {0}", name); this.Output.WriteLine(String.Empty); // Arrange var serializerSettings = new JsonSerializerSettings { Converters = new[] { (JsonConverter) new StringEnumConverter() }, Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Include }; var expectedJson = expectedResourceType.ToJson(serializerSettings); this.Output.WriteLine("Expected ResourceType"); this.Output.WriteLine(expectedJson); // Act var actualResourceType = resourceTypeFactory.Create(conventions); if (complexTypes != null) { var clrTypeToComplexTypeDictionary = complexTypes.ToDictionary(x => x.ClrType); actualResourceType.Initialize(clrTypeToComplexTypeDictionary); } this.Output.WriteLine(String.Empty); var actualJson = actualResourceType.ToJson(serializerSettings); this.Output.WriteLine("Actual ResourceType"); this.Output.WriteLine(actualJson); // Assert ResourceTypeAssert.Equal(expectedResourceType, actualResourceType); }
public void SetUp() { conventions = new Conventions(); errorRetry = new ErrorRetry(new JsonSerializer()); }
private IExchange DeclareVersionedExchanges(IAdvancedBus advancedBus, IConventions conventions, MessageVersionStack messageVersions, string exchangeType) { IExchange destinationExchange = null; while (!messageVersions.IsEmpty()) { var messageType = messageVersions.Pop(); var exchangeName = conventions.ExchangeNamingConvention(messageType); var sourceExchange = DeclareExchange(advancedBus, exchangeName, exchangeType); if (destinationExchange != null) { advancedBus.Bind(sourceExchange, destinationExchange, "#"); } destinationExchange = sourceExchange; } return destinationExchange; }
public void SetUp() { conventions = new Conventions(new TypeNameSerializer()); messageReader = new MessageReader(); }
private async Task <IExchange> DeclareVersionedExchangesAsync(IAdvancedBus advancedBus, IConventions conventions, MessageVersionStack messageVersions, string exchangeType) { IExchange destinationExchange = null; while (!messageVersions.IsEmpty()) { var messageType = messageVersions.Pop(); var exchangeName = conventions.ExchangeNamingConvention(messageType); var sourceExchange = await DeclareExchangeAsync(advancedBus, exchangeName, exchangeType).ConfigureAwait(false); if (destinationExchange != null) { await advancedBus.BindAsync(sourceExchange, destinationExchange, "#").ConfigureAwait(false); } destinationExchange = sourceExchange; } return(destinationExchange); }
public ExceptionlessConsumerErrorStrategy(IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions, ITypeNameSerializer typeNameSerializer, IErrorMessageSerializer errorMessageSerializer, ExceptionlessClient client = null, Action <EventBuilder, ConsumerExecutionContext> intercept = null) : base(connectionFactory, serializer, logger, conventions, typeNameSerializer, errorMessageSerializer) { _client = client ?? ExceptionlessClient.Default; _intercept = intercept; }
public TransactionalRpc(ConnectionConfiguration connectionConfiguration, IAdvancedBus advancedBus, IEventBus eventBus, IConventions conventions, IPublishExchangeDeclareStrategy publishExchangeDeclareStrategy, IMessageDeliveryModeStrategy messageDeliveryModeStrategy, ITimeoutStrategy timeoutStrategy, ITypeNameSerializer typeNameSerializer) : base(connectionConfiguration, advancedBus, eventBus, conventions, publishExchangeDeclareStrategy, messageDeliveryModeStrategy, timeoutStrategy, typeNameSerializer) { this.timeoutStrategy = timeoutStrategy; }
public void Add(Type type, IConventions conventions) => _conventions[type] = conventions;
public void SetUp() { conventions = new Conventions(); messageReader = new MessageReader(); }
/// <summary> /// Returns true of the token is the negative version of a boolean switch. Otherwise false. /// </summary> /// <param name="conventions"></param> /// <param name="parameterName"></param> /// <param name="token"></param> /// <returns></returns> public static bool IsNegatedLongOptionName(this IConventions conventions, string parameterName, string token) { return(conventions.GetNegatedLongOptionName(parameterName) == token); }
protected override void Given() { var requestTypeRegistry = MockRepository.GenerateStub<IRequestTypeRegistry>(); requestTypeRegistry.Stub(r => r.GetRegisteredRequestTypes()).Return(new[] { typeof(TestRequest) }); conventions = new BasicConventions(requestTypeRegistry); }
public void SetUp() { var typeNameSerializer = new TypeNameSerializer(); conventions = new Conventions(typeNameSerializer); errorRetry = new ErrorRetry(new JsonSerializer(typeNameSerializer)); }
public DeadLetterStrategy(IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions, ITypeNameSerializer typeNameSerializer, IErrorMessageSerializer errorMessageSerializer) : base(connectionFactory, serializer, logger, conventions, typeNameSerializer, errorMessageSerializer) { }
public RabbitPublishChannel(RabbitBus bus, Action <IChannelConfiguration> configure, IConventions conventions) { Preconditions.CheckNotNull(conventions, "conventions"); this.bus = bus; this.conventions = conventions; advancedBus = bus.Advanced; advancedPublishChannel = advancedBus.OpenPublishChannel(configure); }
// PUBLIC METHODS /////////////////////////////////////////////////// #region Extension Methods public static IDocumentContextOptionsBuilder UseConventions(this IDocumentContextOptionsBuilder documentContextOptionsBuilder, IConventions conventions) { Contract.Requires(documentContextOptionsBuilder != null); Contract.Requires(conventions != null); documentContextOptionsBuilder.ModifyExtension <CoreDocumentContextExtension>(x => x.Conventions = conventions); return(documentContextOptionsBuilder); }
public ValidatingInterceptor(IConventions conventions) { Conventions = conventions; }
protected ConventionBasedInterceptor() { Conventions = IoC.Container.Resolve <IConventions>(); }
private void CreateBus(IConventions conventions, IModel model) { var advancedBus = new RabbitAdvancedBus( new ConnectionConfiguration(), new MockConnectionFactory(new MockConnection(model)), TypeNameSerializer.Serialize, new JsonSerializer(), new MockConsumerFactory(), new MockLogger(), CorrelationIdGenerator.GetCorrelationId, new Conventions(), new DefaultMessageValidationStrategy(new MockLogger(), TypeNameSerializer.Serialize)); bus = new RabbitBus( x => TypeNameSerializer.Serialize(x.GetType()), new MockLogger(), conventions, advancedBus ); }
public void Send(object message, IConventions conventions, string messageId = null, string correlationId = null, string spanContext = null, object messageContext = null, IDictionary <string, object> headers = null) { var threadId = Thread.CurrentThread.ManagedThreadId; if (!_channels.TryGetValue(threadId, out var channel)) { lock (_lockObject) { if (_channelsCount >= _maxChannels) { throw new InvalidOperationException( $"Cannot create RabbitMQ producer channel for thread: {threadId} " + $"(reached the limit of {_maxChannels} channels). " + "Modify `MaxProducerChannels` setting to allow more channels."); } channel = _connection.CreateModel(); _channels.TryAdd(threadId, channel); _channelsCount++; if (_loggerEnabled) { _logger.LogTrace( $"Created a channel for thread: {threadId}, total channels: {_channelsCount}/{_maxChannels}"); } } } else { if (_loggerEnabled) { _logger.LogTrace( $"Reused a channel for thread: {threadId}, total channels: {_channelsCount}/{_maxChannels}"); } } var payload = _serializer.Serialize(message); var body = Encoding.UTF8.GetBytes(payload); var properties = channel.CreateBasicProperties(); properties.Persistent = _persistMessages; properties.MessageId = string.IsNullOrWhiteSpace(messageId) ? Guid.NewGuid().ToString("N") : messageId; properties.CorrelationId = string.IsNullOrWhiteSpace(correlationId) ? Guid.NewGuid().ToString("N") : correlationId; properties.Timestamp = new AmqpTimestamp(DateTimeOffset.UtcNow.ToUnixTimeSeconds()); properties.Headers = new Dictionary <string, object>(); if (_contextEnabled) { IncludeMessageContext(messageContext, properties); } if (!string.IsNullOrWhiteSpace(spanContext)) { properties.Headers.Add(_spanContextHeader, spanContext); } if (headers is { })
public BusThatSendsConfirmations(IConnectionFactory connectionFactory, IConsumerFactory consumerFactory, IEasyNetQLogger logger, IClientCommandDispatcherFactory clientCommandDispatcherFactory, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IContainer container, ConnectionConfiguration connectionConfiguration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, AdvancedBusEventHandlers advancedBusEventHandlers) : base(connectionFactory, consumerFactory, logger, clientCommandDispatcherFactory, confirmationListener, eventBus, handlerCollectionFactory, container, connectionConfiguration, produceConsumeInterceptor, messageSerializationStrategy, conventions, advancedBusEventHandlers) { }
public RabbitAdvancedBus( IConnectionFactory connectionFactory, IConsumerFactory consumerFactory, IEasyNetQLogger logger, IClientCommandDispatcherFactory clientCommandDispatcherFactory, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IContainer container, ConnectionConfiguration connectionConfiguration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, AdvancedBusEventHandlers advancedBusEventHandlers, IPersistentConnectionFactory persistentConnectionFactory) { Preconditions.CheckNotNull(connectionFactory, "connectionFactory"); Preconditions.CheckNotNull(consumerFactory, "consumerFactory"); Preconditions.CheckNotNull(logger, "logger"); Preconditions.CheckNotNull(eventBus, "eventBus"); Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory"); Preconditions.CheckNotNull(container, "container"); Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy"); Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration"); Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); Preconditions.CheckNotNull(persistentConnectionFactory, "persistentConnectionFactory"); this.consumerFactory = consumerFactory; this.logger = logger; this.confirmationListener = confirmationListener; this.eventBus = eventBus; this.handlerCollectionFactory = handlerCollectionFactory; this.container = container; this.connectionConfiguration = connectionConfiguration; this.produceConsumeInterceptor = produceConsumeInterceptor; this.messageSerializationStrategy = messageSerializationStrategy; this.conventions = conventions; this.eventBus.Subscribe <ConnectionCreatedEvent>(e => OnConnected()); if (advancedBusEventHandlers.Connected != null) { Connected += advancedBusEventHandlers.Connected; } this.eventBus.Subscribe <ConnectionDisconnectedEvent>(e => OnDisconnected()); if (advancedBusEventHandlers.Disconnected != null) { Disconnected += advancedBusEventHandlers.Disconnected; } this.eventBus.Subscribe <ConnectionBlockedEvent>(OnBlocked); if (advancedBusEventHandlers.Blocked != null) { Blocked += advancedBusEventHandlers.Blocked; } this.eventBus.Subscribe <ConnectionUnblockedEvent>(e => OnUnblocked()); if (advancedBusEventHandlers.Unblocked != null) { Unblocked += advancedBusEventHandlers.Unblocked; } this.eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned); if (advancedBusEventHandlers.MessageReturned != null) { MessageReturned += advancedBusEventHandlers.MessageReturned; } connection = persistentConnectionFactory.CreateConnection(); clientCommandDispatcher = clientCommandDispatcherFactory.GetClientCommandDispatcher(connection); connection.Initialize(); }
/// <summary> /// Returns true if the parameter is matched by the token. Otherwise false. /// </summary> /// <param name="conventions"></param> /// <param name="parameter"></param> /// <param name="token"></param> /// <returns></returns> public static bool IsMatchingParameter(this IConventions conventions, Parameter parameter, string token) { return(conventions.IsMatchingParameterName(parameter.Name, token)); }
public void Add <T>(IConventions conventions) => Add(typeof(T), conventions);
public void TestServiceModelBuilderCreateServiceModel(string name, IServiceModelFactory serviceModelFactory, IConventions conventions, IServiceModel expectedServiceModel) { this.Output.WriteLine("Test Name: {0}", name); this.Output.WriteLine(String.Empty); // Arrange var serializerSettings = new JsonSerializerSettings { Converters = new[] { (JsonConverter) new StringEnumConverter() }, Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Include }; var expectedJson = expectedServiceModel.ToJson(serializerSettings); this.Output.WriteLine("Expected ServiceModel"); this.Output.WriteLine(expectedJson); // Act var actualServiceModel = serviceModelFactory.Create(conventions); this.Output.WriteLine(String.Empty); var actualJson = actualServiceModel.ToJson(serializerSettings); this.Output.WriteLine("Actual ServiceModel"); this.Output.WriteLine(actualJson); // Assert ServiceModelAssert.Equal(expectedServiceModel, actualServiceModel); }
protected override void Given() { var requestHandlerRegistry = MockRepository.GenerateStub<IRequestHandlerRegistry>(); requestHandlerRegistry.Stub(r => r.GetTypedRequestHandlers()).Return(new[] { typeof(RequestHandlerA) }); conventions = new RequestHandlerBasedConventions(requestHandlerRegistry); }
public void TestComplexTypeBuilderCreateComplexType(string name, IComplexTypeFactory complexTypeFactory, IConventions conventions, IComplexType expectedComplexType) { this.Output.WriteLine("Test Name: {0}", name); this.Output.WriteLine(String.Empty); // Arrange var serializerSettings = new JsonSerializerSettings { Converters = new[] { (JsonConverter) new StringEnumConverter() }, Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Include }; var expectedJson = expectedComplexType.ToJson(serializerSettings); this.Output.WriteLine("Expected ComplexType"); this.Output.WriteLine(expectedJson); // Act var actualComplexType = complexTypeFactory.Create(conventions); this.Output.WriteLine(String.Empty); var actualJson = actualComplexType.ToJson(serializerSettings); this.Output.WriteLine("Actual ComplexType"); this.Output.WriteLine(actualJson); // Assert ComplexTypeAssert.Equal(expectedComplexType, actualComplexType); }
public ConsumerErrorStrategy(IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions, ITypeNameSerializer typeNameSerializer) : base(connectionFactory, serializer, logger, conventions, typeNameSerializer) { }
/// <summary> /// Returns the formatted action name for a given method. /// </summary> /// <param name="conventions"></param> /// <param name="method"></param> /// <returns></returns> public static string GetActionName(this IConventions conventions, MethodInfo method) { return(conventions.GetActionName(method.Name)); }
public ChannelInfo(IModel channel, IConventions conventions) { Channel = channel; Conventions = conventions; }
/// <summary> /// Clear any conventions /// </summary> public void Clear() { IdentityChecker = new NullIdentityChecker(); TypeConventions = new TypeConventions(); PropertyConventions = new PropertyConventions(); }