/// <summary> /// Configure a Batch<<typeparamref name="TMessage"/>> consumer, which allows messages to be collected into an array and consumed /// at once. This feature is experimental, but often requested. Be sure to configure the transport with sufficient concurrent message /// capacity (prefetch, etc.) so that a batch can actually complete without always reaching the time limit. /// </summary> /// <typeparam name="TMessage"></typeparam> /// <param name="configurator"></param> /// <param name="configure"></param> /// <returns></returns> public static void Batch <TMessage>(this IReceiveEndpointConfigurator configurator, Action <IBatchConfigurator <TMessage> > configure) where TMessage : class { LogContext.Debug?.Log("Configuring batch: {MessageType}", TypeMetadataCache <TMessage> .ShortName); var batchConfigurator = new BatchConfigurator <TMessage>(configurator); configure?.Invoke(batchConfigurator); }
/// <summary> /// Connect a batch consumer /// </summary> /// <typeparam name="TMessage"></typeparam> /// <param name="configurator"></param> /// <param name="configure"></param> /// <returns></returns> public static void Batch <TMessage>(this IReceiveEndpointConfigurator configurator, Action <IBatchConfigurator <TMessage> > configure) where TMessage : class { if (_log.IsDebugEnabled) { _log.DebugFormat("Configuring batch: {0}", TypeMetadataCache <TMessage> .ShortName); } var batchConfigurator = new BatchConfigurator <TMessage>(configurator); configure?.Invoke(batchConfigurator); }