public static void Main(string[] args) { var typeNameSerializer = new LegacyTypeNameSerializer(); var argParser = new ArgParser(); var arguments = argParser.Parse(args); bool enableBinaryPayloads = false; arguments.WithTypedKeyOptional <bool>("b", a => enableBinaryPayloads = bool.Parse(a.Value)) .FailWith(messsage("Invalid enable binary payloads (b) parameter")); IErrorMessageSerializer errorMessageSerializer; if (enableBinaryPayloads) { errorMessageSerializer = new Base64ErrorMessageSerializer(); } else { errorMessageSerializer = new DefaultErrorMessageSerializer(); } // poor man's dependency injection FTW ;) var program = new Program( argParser, new QueueRetreival(errorMessageSerializer), new FileMessageWriter(), new MessageReader(), new QueueInsertion(errorMessageSerializer), new ErrorRetry(new JsonSerializer(), errorMessageSerializer), new Conventions(typeNameSerializer)); program.Start(args); }
public DefaultConsumerErrorStrategyTests() { var configuration = new ConnectionConfiguration { Hosts = new List <HostConfiguration> { new HostConfiguration { Host = "localhost", Port = 5672 } }, UserName = "******", Password = "******" }; configuration.Validate(); var typeNameSerializer = new DefaultTypeNameSerializer(); var errorMessageSerializer = new DefaultErrorMessageSerializer(); connectionFactory = new ConnectionFactoryWrapper(configuration, new RandomClusterHostSelectionStrategy <ConnectionFactoryInfo>()); serializer = new JsonSerializer(); conventions = new Conventions(typeNameSerializer); consumerErrorStrategy = new DefaultConsumerErrorStrategy( connectionFactory, serializer, conventions, typeNameSerializer, errorMessageSerializer); }