static void Main() { BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.Encryption.Endpoint1"); busConfiguration.RijndaelEncryptionService(); busConfiguration.UsePersistence<InMemoryPersistence>(); using (IBus bus = Bus.Create(busConfiguration).Start()) { MessageWithSecretData message = new MessageWithSecretData { Secret = "betcha can't guess my secret", SubProperty = new MySecretSubProperty { Secret = "My sub secret" }, CreditCards = new List<CreditCardDetails> { new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(1), Number = "312312312312312" }, new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(2), Number = "543645546546456" } } }; bus.Send("Samples.Encryption.Endpoint2", message); Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadKey(); } }
static async Task AsyncMain() { Console.Title = "Samples.Encryption.Endpoint1"; var endpointConfiguration = new EndpointConfiguration("Samples.Encryption.Endpoint1"); #region enableEncryption endpointConfiguration.RijndaelEncryptionService(); #endregion endpointConfiguration.UsePersistence<InMemoryPersistence>(); endpointConfiguration.UseSerialization<JsonSerializer>(); endpointConfiguration.SendFailedMessagesTo("error"); var endpointInstance = await Endpoint.Start(endpointConfiguration) .ConfigureAwait(false); try { var message = new MessageWithSecretData { Secret = "betcha can't guess my secret", SubProperty = new MySecretSubProperty { Secret = "My sub secret" }, CreditCards = new List<CreditCardDetails> { new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(1), Number = "312312312312312" }, new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(2), Number = "543645546546456" } } }; await endpointInstance.Send("Samples.Encryption.Endpoint2", message) .ConfigureAwait(false); Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadKey(); } finally { await endpointInstance.Stop() .ConfigureAwait(false); } }
static void Main() { Console.Title = "Samples.Encryption.Endpoint1"; Configure.Serialization.Json(); var configure = Configure.With(); configure.Log4Net(); configure.DefineEndpointName("Samples.Encryption.Endpoint1"); configure.DefaultBuilder(); #region enableEncryption configure.RijndaelEncryptionService(); #endregion configure.UseTransport<Msmq>(); configure.InMemorySagaPersister(); configure.UseInMemoryTimeoutPersister(); configure.InMemorySubscriptionStorage(); using (var startableBus = configure.UnicastBus().CreateBus()) { var bus = startableBus.Start(() => configure.ForInstallationOn<Windows>().Install()); var message = new MessageWithSecretData { Secret = "betcha can't guess my secret", SubProperty = new MySecretSubProperty { Secret = "My sub secret" }, CreditCards = new List<CreditCardDetails> { new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(1), Number = "312312312312312" }, new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(2), Number = "543645546546456" } } }; bus.Send("Samples.Encryption.Endpoint2", message); Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadKey(); } }
static async Task AsyncMain() { BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.Encryption.Endpoint1"); busConfiguration.RijndaelEncryptionService(); busConfiguration.UsePersistence<InMemoryPersistence>(); busConfiguration.SendFailedMessagesTo("error"); IEndpointInstance endpoint = await Endpoint.Start(busConfiguration); try { IBusSession busSession = endpoint.CreateBusSession(); MessageWithSecretData message = new MessageWithSecretData { Secret = "betcha can't guess my secret", SubProperty = new MySecretSubProperty { Secret = "My sub secret" }, CreditCards = new List<CreditCardDetails> { new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(1), Number = "312312312312312" }, new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(2), Number = "543645546546456" } } }; await busSession.Send("Samples.Encryption.Endpoint2", message); Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadKey(); } finally { await endpoint.Stop(); } }
static void Main() { Configure configure = Configure.With(); configure.DefineEndpointName("Samples.Encryption.Endpoint1"); configure.DefaultBuilder(); configure.RijndaelEncryptionService(); configure.MsmqTransport(); configure.InMemorySagaPersister(); configure.RunTimeoutManagerWithInMemoryPersistence(); configure.InMemorySubscriptionStorage(); configure.JsonSerializer(); IBus bus = configure.UnicastBus() .CreateBus() .Start(() => Configure.Instance.ForInstallationOn <Windows>().Install()); MessageWithSecretData message = new MessageWithSecretData { Secret = "betcha can't guess my secret", SubProperty = new MySecretSubProperty { Secret = "My sub secret" }, CreditCards = new List <CreditCardDetails> { new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(1), Number = "312312312312312" }, new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(2), Number = "543645546546456" } } }; bus.Send("Samples.Encryption.Endpoint2", message); Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadLine(); }
static void Main() { Console.Title = "Samples.Encryption.Endpoint1"; var busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.Encryption.Endpoint1"); #region enableEncryption busConfiguration.RijndaelEncryptionService(); #endregion busConfiguration.UsePersistence <InMemoryPersistence>(); busConfiguration.UseSerialization <JsonSerializer>(); using (var bus = Bus.Create(busConfiguration).Start()) { var message = new MessageWithSecretData { Secret = "betcha can't guess my secret", SubProperty = new MySecretSubProperty { Secret = "My sub secret" }, CreditCards = new List <CreditCardDetails> { new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(1), Number = "312312312312312" }, new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(2), Number = "543645546546456" } } }; bus.Send("Samples.Encryption.Endpoint2", message); Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadKey(); } }
static void Main() { BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.EndpointName("Samples.Encryption.Endpoint1"); busConfiguration.RijndaelEncryptionService("gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6"); busConfiguration.UsePersistence <InMemoryPersistence>(); IStartableBus startableBus = Bus.Create(busConfiguration); using (IBus bus = startableBus.Start()) { MessageWithSecretData message = new MessageWithSecretData { Secret = "betcha can't guess my secret", SubProperty = new MySecretSubProperty { Secret = "My sub secret" }, CreditCards = new List <CreditCardDetails> { new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(1), Number = "312312312312312" }, new CreditCardDetails { ValidTo = DateTime.UtcNow.AddYears(2), Number = "543645546546456" } } }; bus.Send("Samples.Encryption.Endpoint2", message); Console.WriteLine("MessageWithSecretData sent. Press any key to exit"); Console.ReadLine(); } }