public ServiceBrokerMessageTransport(LightRailConfiguration config, ServiceBrokerMessageTransportConfiguration transportConfiguration)
 {
     ServiceBrokerMessageType = transportConfiguration.ServiceBrokerMessageType;
     if (string.IsNullOrWhiteSpace(ServiceBrokerMessageType))
     {
         throw new InvalidConfigurationException("ServiceBrokerMessageType cannot be Null or WhiteSpace");
     }
     ServiceBrokerContract = transportConfiguration.ServiceBrokerContract;
     if (string.IsNullOrWhiteSpace(ServiceBrokerContract))
     {
         throw new InvalidConfigurationException("ServiceBrokerContract cannot be Null or WhiteSpace");
     }
     ServiceBrokerQueue = transportConfiguration.ServiceBrokerQueue;
     if (string.IsNullOrWhiteSpace(ServiceBrokerQueue))
     {
         throw new InvalidConfigurationException("ServiceBrokerQueue cannot be Null or WhiteSpace");
     }
     ServiceBrokerService = transportConfiguration.ServiceBrokerService;
     if (string.IsNullOrWhiteSpace(ServiceBrokerService))
     {
         throw new InvalidConfigurationException("ServiceBrokerService cannot be Null or WhiteSpace");
     }
     ConnectionString = transportConfiguration.ServiceBrokerConnectionString;
     if (string.IsNullOrWhiteSpace(ConnectionString) &&
         !string.IsNullOrWhiteSpace(transportConfiguration.ServiceBrokerConnectionStringName) &&
         ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName] != null)
     {
         ConnectionString = ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName].ConnectionString;
     }
     if (string.IsNullOrWhiteSpace(ConnectionString))
     {
         throw new InvalidConfigurationException("ServiceBrokerConnectionString cannot be Null or WhiteSpace");
     }
     MaxRetries = transportConfiguration.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = transportConfiguration.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     if (MaxConcurrency > 0)
     {
         workerThreadPool = new Semaphore(MaxConcurrency, MaxConcurrency);
     }
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }
 public ServiceBrokerMessageTransport(LightRailConfiguration config, ServiceBrokerMessageTransportConfiguration transportConfiguration)
 {
     ServiceBrokerMessageType = transportConfiguration.ServiceBrokerMessageType;
     if (string.IsNullOrWhiteSpace(ServiceBrokerMessageType))
     {
         throw new InvalidConfigurationException("ServiceBrokerMessageType cannot be Null or WhiteSpace");
     }
     ServiceBrokerContract = transportConfiguration.ServiceBrokerContract;
     if (string.IsNullOrWhiteSpace(ServiceBrokerContract))
     {
         throw new InvalidConfigurationException("ServiceBrokerContract cannot be Null or WhiteSpace");
     }
     ServiceBrokerQueue = transportConfiguration.ServiceBrokerQueue;
     if (string.IsNullOrWhiteSpace(ServiceBrokerQueue))
     {
         throw new InvalidConfigurationException("ServiceBrokerQueue cannot be Null or WhiteSpace");
     }
     ServiceBrokerService = transportConfiguration.ServiceBrokerService;
     if (string.IsNullOrWhiteSpace(ServiceBrokerService))
     {
         throw new InvalidConfigurationException("ServiceBrokerService cannot be Null or WhiteSpace");
     }
     ConnectionString = transportConfiguration.ServiceBrokerConnectionString;
     if (string.IsNullOrWhiteSpace(ConnectionString) &&
         !string.IsNullOrWhiteSpace(transportConfiguration.ServiceBrokerConnectionStringName) &&
         ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName] != null)
     {
         ConnectionString = ConfigurationManager.ConnectionStrings[transportConfiguration.ServiceBrokerConnectionStringName].ConnectionString;
     }
     if (string.IsNullOrWhiteSpace(ConnectionString))
     {
         throw new InvalidConfigurationException("ServiceBrokerConnectionString cannot be Null or WhiteSpace");
     }
     MaxRetries = transportConfiguration.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = transportConfiguration.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     if (MaxConcurrency > 0)
     {
         workerThreadPool = new Semaphore(MaxConcurrency, MaxConcurrency);
     }
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }
Exemplo n.º 3
0
    static void Main(string[] args)
    {
        var config = new LightRailConfiguration();
        config.AddAssemblyToScan(typeof(Program).Assembly);
        config.AddAssemblyToScan(typeof(RequestDataMessage).Assembly);
        config.UseTransport<ServiceBrokerMessageTransport, ServiceBrokerMessageTransportConfiguration>();
        config.TransportConfigurationAs<ServiceBrokerMessageTransportConfiguration>().ServiceBrokerConnectionString = "server=localhost;database=servicebus;integrated security=true;";
        config.TransportConfigurationAs<ServiceBrokerMessageTransportConfiguration>().ServiceBrokerQueue = "SamplesFullDuplexServer";
        config.TransportConfigurationAs<ServiceBrokerMessageTransportConfiguration>().ServiceBrokerService = "SamplesFullDuplexServer";

        //LogManager.Use<DefaultFactory>()
        //    .Level(LogLevel.Info);

        var client = config.CreateBus().Start();

        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
Exemplo n.º 4
0
    static void Main(string[] args)
    {
        var config = new LightRailConfiguration();

        config.AddAssemblyToScan(typeof(Program).Assembly);
        config.AddAssemblyToScan(typeof(RequestDataMessage).Assembly);
        config.UseTransport <ServiceBrokerMessageTransport, ServiceBrokerMessageTransportConfiguration>();
        config.TransportConfigurationAs <ServiceBrokerMessageTransportConfiguration>().ServiceBrokerConnectionString = "server=localhost;database=servicebus;integrated security=true;";
        config.TransportConfigurationAs <ServiceBrokerMessageTransportConfiguration>().ServiceBrokerQueue            = "SamplesFullDuplexServer";
        config.TransportConfigurationAs <ServiceBrokerMessageTransportConfiguration>().ServiceBrokerService          = "SamplesFullDuplexServer";

        //LogManager.Use<DefaultFactory>()
        //    .Level(LogLevel.Info);

        var client = config.CreateBus().Start();

        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
Exemplo n.º 5
0
    static void Main(string[] args)
    {
        var config = new LightRailConfiguration();

        config.AddAssemblyToScan(typeof(Program).Assembly);
        config.AddAssemblyToScan(typeof(RequestDataMessage).Assembly);
        config.UseTransport <ServiceBrokerMessageTransport, ServiceBrokerMessageTransportConfiguration>();
        config.TransportConfigurationAs <ServiceBrokerMessageTransportConfiguration>().ServiceBrokerConnectionString = "server=localhost;database=servicebus;integrated security=true;";
        config.TransportConfigurationAs <ServiceBrokerMessageTransportConfiguration>().ServiceBrokerQueue            = "SamplesFullDuplexClient";
        config.TransportConfigurationAs <ServiceBrokerMessageTransportConfiguration>().ServiceBrokerService          = "SamplesFullDuplexClient";

        //LogManager.Use<DefaultFactory>()
        //    .Level(LogLevel.Info);

        var client = config.CreateBus().Start();

        Console.WriteLine("Press enter to send a message");
        Console.WriteLine("Press any key to exit");
        while (true)
        {
            ConsoleKeyInfo key = Console.ReadKey();
            Console.WriteLine();

            if (key.Key != ConsoleKey.Enter)
            {
                return;
            }

            var guid = Guid.NewGuid();
            Console.WriteLine("Requesting to get data by id: {0}", guid.ToString("N"));

            RequestDataMessage message = new RequestDataMessage
            {
                DataId = guid,
                String = "<node>it's my \"node\" & i like it<node>"
            };
            client.Send(message, "SamplesFullDuplexServer");
        }
    }
Exemplo n.º 6
0
    static void Main(string[] args)
    {
        var config = new LightRailConfiguration();
        config.AddAssemblyToScan(typeof(Program).Assembly);
        config.AddAssemblyToScan(typeof(RequestDataMessage).Assembly);
        config.UseTransport<ServiceBrokerMessageTransport, ServiceBrokerMessageTransportConfiguration>();
        config.TransportConfigurationAs<ServiceBrokerMessageTransportConfiguration>().ServiceBrokerConnectionString = "server=localhost;database=servicebus;integrated security=true;";
        config.TransportConfigurationAs<ServiceBrokerMessageTransportConfiguration>().ServiceBrokerQueue = "SamplesFullDuplexClient";
        config.TransportConfigurationAs<ServiceBrokerMessageTransportConfiguration>().ServiceBrokerService = "SamplesFullDuplexClient";

        //LogManager.Use<DefaultFactory>()
        //    .Level(LogLevel.Info);

        var client = config.CreateBus().Start();

        Console.WriteLine("Press enter to send a message");
        Console.WriteLine("Press any key to exit");
        while (true)
        {
            ConsoleKeyInfo key = Console.ReadKey();
            Console.WriteLine();

            if (key.Key != ConsoleKey.Enter)
            {
                return;
            }

            var guid = Guid.NewGuid();
            Console.WriteLine("Requesting to get data by id: {0}", guid.ToString("N"));

            RequestDataMessage message = new RequestDataMessage
            {
                DataId = guid,
                String = "<node>it's my \"node\" & i like it<node>"
            };
            client.Send(message, "SamplesFullDuplexServer");
        }
    }
Exemplo n.º 7
0
 public MsmqTransport(LightRailConfiguration config, MsmqTransportConfiguration transportConfiguration)
 {
     InputQueue = transportConfiguration.InputQueue;
     if (string.IsNullOrWhiteSpace(InputQueue))
     {
         throw new InvalidConfigurationException("InputQueue cannot be Null or WhiteSpace");
     }
     MaxRetries = transportConfiguration.MaxRetries;
     if (MaxRetries < 0)
     {
         MaxRetries = 0;
     }
     MaxConcurrency = transportConfiguration.MaxConcurrency;
     if (MaxConcurrency < 0)
     {
         MaxConcurrency = 0;
     }
     if (MaxConcurrency > 0)
     {
         workerThreadPool = new Semaphore(MaxConcurrency, MaxConcurrency);
     }
     faultManager = new TransportMessageFaultManager(MaxRetries);
 }