public static void ApplyCustomConventions(this Configure configure) { configure.FileShareDataBus(@"..\..\..\DataBusShare\"); configure.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith("Commands")); configure.DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith("Events")); configure.DefiningMessagesAs(t => t.Namespace == "Messages"); configure.DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted")); configure.DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus")); configure.DefiningExpressMessagesAs(t => t.Name.EndsWith("Express")); configure.DefiningTimeToBeReceivedAs(t => t.Name.EndsWith("Expires") ? TimeSpan.FromSeconds(30) : TimeSpan.MaxValue); }
void MessageConventions(Configure configure) { #region 4to5MessageConventions // NOTE: When self hosting, '.DefiningXXXAs()' has to be before '.UnicastBus()', // otherwise it will result in: // 'InvalidOperationException: "No destination specified for message(s): MessageTypeName" configure.DefaultBuilder(); configure.DefiningCommandsAs( type => { return(type.Namespace == "MyNamespace" && type.Namespace.EndsWith("Commands")); }); configure.DefiningEventsAs( type => { return(type.Namespace == "MyNamespace" && type.Namespace.EndsWith("Events")); }); configure.DefiningMessagesAs( type => { return(type.Namespace == "Messages"); }); configure.DefiningEncryptedPropertiesAs( property => { return(property.Name.StartsWith("Encrypted")); }); configure.DefiningDataBusPropertiesAs( property => { return(property.Name.EndsWith("DataBus")); }); configure.DefiningExpressMessagesAs( type => { return(type.Name.EndsWith("Express")); }); configure.DefiningTimeToBeReceivedAs( type => { if (type.Name.EndsWith("Expires")) { return(TimeSpan.FromSeconds(30)); } return(TimeSpan.MaxValue); }); #endregion }
void Simple(Configure configure) { #region DiscardingOldMessagesWithCode configure.DefiningTimeToBeReceivedAs(type => { if (type == typeof(MyMessage)) { return(TimeSpan.FromHours(1)); } return(TimeSpan.MaxValue); }); #endregion }
void Simple(Configure configure) { #region DiscardingOldMessagesWithCode configure.DefiningTimeToBeReceivedAs(type => { if (type == typeof(MyMessage)) { return TimeSpan.FromHours(1); } return TimeSpan.MaxValue; }); #endregion }
Usage(Configure configure) { #region MessageConventions // NOTE: When you're self hosting, '.DefiningXXXAs()' has to be before '.UnicastBus()', // otherwise you'll get: 'System.InvalidOperationException: "No destination specified for message(s): MessageTypeName" configure.DefiningCommandsAs(t => t.Namespace == "MyNamespace.Messages.Commands"); configure.DefiningEventsAs(t => t.Namespace == "MyNamespace.Messages.Events"); configure.DefiningMessagesAs(t => t.Namespace == "MyNamespace.Messages"); configure.DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted")); configure.DefiningDataBusPropertiesAs(p =>p.Name.EndsWith("DataBus")); configure.DefiningExpressMessagesAs(t =>t.Name.EndsWith("Express")); configure.DefiningTimeToBeReceivedAs(t => t.Name.EndsWith("Expires") ? TimeSpan.FromSeconds(30) : TimeSpan.MaxValue); #endregion }
void MessageConventions(Configure configure) { #region 4to5MessageConventions // NOTE: When you're self hosting, '.DefiningXXXAs()' has to be before '.UnicastBus()', // otherwise you'll get: 'System.InvalidOperationException: "No destination specified for message(s): MessageTypeName" configure.DefaultBuilder(); configure.DefiningCommandsAs(t => t.Namespace == "MyNamespace" && t.Namespace.EndsWith("Commands")); configure.DefiningEventsAs(t => t.Namespace == "MyNamespace" && t.Namespace.EndsWith("Events")); configure.DefiningMessagesAs(t => t.Namespace == "Messages"); configure.DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted")); configure.DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus")); configure.DefiningExpressMessagesAs(t => t.Name.EndsWith("Express")); configure.DefiningTimeToBeReceivedAs(t => t.Name.EndsWith("Expires") ? TimeSpan.FromSeconds(30) : TimeSpan.MaxValue); #endregion }