Exemple #1
0
    static void SendBinaryMessage()
    {
        MessageWithBinary message = new MessageWithBinary
        {
            SomeProperty = "Some content in a binary message",
        };

        bus.Send("Sample.MultiSerializer.Receiver", message);
        Console.WriteLine();
        Console.WriteLine("Binary message sent");
    }
    static void SendMessageWithFileStream()
    {
        #region send-message-with-file-stream

        MessageWithStream message = new MessageWithStream
        {
            SomeProperty   = "This message contains a stream",
            StreamProperty = File.OpenRead("FileToSend.txt")
        };
        bus.Send("Sample.PipelineStream.Receiver", message);
        #endregion

        Console.WriteLine();
        Console.WriteLine("Message with file stream sent");
    }
Exemple #3
0
    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();

        busConfiguration.EndpointName("Samples.FullDuplex.Client");
        busConfiguration.UseSerialization <JsonSerializer>();
        busConfiguration.UsePersistence <InMemoryPersistence>();
        busConfiguration.EnableInstallers();

        using (IStartableBus bus = Bus.Create(busConfiguration))
        {
            bus.Start();
            Console.WriteLine("Press 'Enter' to send a message.To exit, Ctrl + C");

            #region ClientLoop

            while (Console.ReadLine() != null)
            {
                Guid g = Guid.NewGuid();
                Console.WriteLine("Requesting to get data by id: {0}", g.ToString("N"));

                RequestDataMessage message = new RequestDataMessage
                {
                    DataId = g,
                    String = "<node>it's my \"node\" & i like it<node>"
                };
                bus.Send("Samples.FullDuplex.Server", message);
            }

            #endregion
        }
    }
Exemple #4
0
    static void Main()
    {
        BusConfiguration busConfiguration = new BusConfiguration();

        busConfiguration.EndpointName("Samples.FaultTolerance.Client");
        busConfiguration.UseSerialization <JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence <InMemoryPersistence>();

        using (IStartableBus bus = Bus.Create(busConfiguration))
        {
            bus.Start();
            Console.WriteLine("Press 'Enter' to send a message.To exit, Ctrl + C");

            while (Console.ReadLine() != null)
            {
                Guid id = Guid.NewGuid();

                bus.Send("Samples.FaultTolerance.Server", new MyMessage
                {
                    Id = id
                });

                Console.WriteLine("Sent a new message with id: {0}", id.ToString("N"));
            }
        }
    }
        void Callbacks()
        {
            #region sqlserver-config-callbacks 2

            BusConfiguration busConfiguration = new BusConfiguration();
            IStartableBus    bus      = Bus.Create(busConfiguration);
            ICallback        callback = bus.Send(new Request());
            callback.Register(ProcessResponse);
            #endregion

            #region sqlserver-config-callbacks-reply 2

            bus.Return(42);

            #endregion
        }
Exemple #6
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var configuration = new BusConfiguration();

            configuration.AzureConfigurationSource();
            configuration.UseTransport <AzureStorageQueueTransport>();
            configuration.UsePersistence <AzureStoragePersistence>();
            configuration.ApplyMessageConventions();
            startableBus = Bus.Create(configuration);
            startableBus.Start();

            startableBus.Send <Ping>(ping => ping.Message = "ping from web");
            Trace.WriteLine("WebRole - sent a message");
        }