public override Task PublishManyFromOutboxAsync(IEnumerable <OutgoingEventInfo> outgoingEvents, OutboxConfig outboxConfig) { var producer = ProducerPool.Get(AbpKafkaEventBusOptions.ConnectionName); var outgoingEventArray = outgoingEvents.ToArray(); foreach (var outgoingEvent in outgoingEventArray) { var messageId = outgoingEvent.Id.ToString("N"); var headers = new Headers { { "messageId", System.Text.Encoding.UTF8.GetBytes(messageId) } }; producer.Produce( AbpKafkaEventBusOptions.TopicName, new Message <string, byte[]> { Key = outgoingEvent.EventName, Value = outgoingEvent.EventData, Headers = headers }); } return(Task.CompletedTask); }
private Task <DeliveryResult <string, byte[]> > PublishAsync( string topicName, string eventName, byte[] body, Headers headers, Dictionary <string, object> headersArguments) { var producer = ProducerPool.Get(AbpKafkaEventBusOptions.ConnectionName); return(PublishAsync(producer, topicName, eventName, body, headers, headersArguments)); }
public override async Task PublishAsync(Type eventType, object eventData) { var eventName = EventNameAttribute.GetNameOrDefault(eventType); var body = Serializer.Serialize(eventData); var producer = ProducerPool.Get(AbpKafkaEventBusOptions.ConnectionName); await producer.ProduceAsync( AbpKafkaEventBusOptions.TopicName, new Message <string, byte[]> { Key = eventName, Value = body }); }
private async Task PublishAsync(string topicName, string eventName, byte[] body, Headers headers, Dictionary <string, object> headersArguments) { var producer = ProducerPool.Get(AbpKafkaEventBusOptions.ConnectionName); SetEventMessageHeaders(headers, headersArguments); await producer.ProduceAsync( topicName, new Message <string, byte[]> { Key = eventName, Value = body, Headers = headers }); }
private async Task PublishAsync(string topicName, Type eventType, object eventData, Headers headers, Dictionary <string, object> headersArguments) { var eventName = EventNameAttribute.GetNameOrDefault(eventType); var body = Serializer.Serialize(eventData); var producer = ProducerPool.Get(AbpKafkaEventBusOptions.ConnectionName); SetEventMessageHeaders(headers, headersArguments); await producer.ProduceAsync( topicName, new Message <string, byte[]> { Key = eventName, Value = body, Headers = headers }); }
private Task <DeliveryResult <string, byte[]> > PublishAsync( string topicName, string eventName, byte[] body, Headers headers) { var producer = ProducerPool.Get(AbpKafkaEventBusOptions.ConnectionName); return(producer.ProduceAsync( topicName, new Message <string, byte[]> { Key = eventName, Value = body, Headers = headers })); }