Ejemplo n.º 1
0
 public async Task withRuntime()
 {
     if (_runtime == null)
     {
         _runtime = await JasperRuntime.BasicAsync();
     }
 }
        public async Task see_the_customizations_happen_inside_of_message_context()
        {
            var runtime = await JasperRuntime.BasicAsync();


            try
            {
                var context = runtime.Get <IMessageContext>();

                // Just to force the message context to pool up the envelope instead
                // of sending it out
                await context.EnlistInTransaction(new InMemoryEnvelopeTransaction());

                var mySpecialMessage = new MySpecialMessage();

                await context.Send("tcp://localhost:2001".ToUri(), mySpecialMessage);

                var outgoing = context.As <MessageContext>().Outstanding.Single();

                outgoing.Headers["special"].ShouldBe("true");
            }
            finally
            {
                await runtime.Shutdown();
            }
        }