Ejemplo n.º 1
0
        public WireUpItem GetWireUp(InitializerWireUp wireup)
        {
            OnTheWireBusConfiguration configuration = new OnTheWireBusConfiguration(10, @"tcp://127.0.0.1:5565",
                                                                                    new BinaryFormatter(), new ASCIIEncoding() );
            ObjectFactory.Inject<OnTheWireBusConfiguration>(configuration);
            return new WireUpItem(
                x =>
                    {
                        x.For<IMessageSubscriber>()
                            .Singleton()
                            .Use<MessageSubscriber>();

                        x.For<IMessagePublisher>()
                            .Singleton()
                            .Use<MessagePublisher>();

                        x.For<IHandlerResolver>()
                            .Use<AggregateRootInspector>();

                        x.Scan(
                            s =>
                                {
                                    foreach (Assembly assembly in wireup.Assemblies)
                                    {
                                        s.Assembly(assembly);
                                        s.Convention<MessageHandlerTypeConvention>();
                                        s.Convention<RequestHandlerTypeConvention>();
                                    }
                                    //s.WithDefaultConventions();
                                }
                            );
                    }
                );
        }
 public MessagePublisher(OnTheWireBusConfiguration configuration)
 {
     _configuration = configuration;
     _context = new Context(configuration.MaxThreads);
     _publisher = _context.Socket(SocketType.PUB);
     _publisher.Bind(configuration.FullyQualifiedAddress);
 }