Example #1
0
        private async Task <DeliveryResult <byte[], byte[]> > InternalProduceAsync(ProducerMessageContext context)
        {
            DeliveryResult <byte[], byte[]> result = null;

            try
            {
                result = await this
                         .EnsureProducer()
                         .ProduceAsync(
                    context.Topic,
                    CreateMessage(context))
                         .ConfigureAwait(false);
            }
            catch (ProduceException <byte[], byte[]> e)
            {
                if (e.Error.IsFatal)
                {
                    this.InvalidateProducer(e.Error, result);
                }

                throw;
            }

            context.Offset    = result.Offset;
            context.Partition = result.Partition;

            return(result);
        }
Example #2
0
        private async Task <DeliveryResult <byte[], byte[]> > InternalProduceAsync(ProducerMessageContext context)
        {
            var result = await this.producer
                         .ProduceAsync(
                context.Topic,
                CreateMessage(context))
                         .ConfigureAwait(false);

            context.Offset    = result.Offset;
            context.Partition = result.Partition;

            return(result);
        }
Example #3
0
        private void InternalProduce(
            ProducerMessageContext context,
            Action <DeliveryReport <byte[], byte[]> > deliveryHandler)
        {
            this.producer
            .Produce(
                context.Topic,
                CreateMessage(context),
                report =>
            {
                context.Offset    = report.Offset;
                context.Partition = report.Partition;

                deliveryHandler(report);
            });
        }
Example #4
0
        private void InternalProduce(
            ProducerMessageContext context,
            Action <XXXDeliveryReport> deliveryHandler)
        {
            this.EnsureProducer().Produce(context.Topic, CreateMessage(context),
                                          report =>
            {
                var result = Util.XXXDeliveryResult(report);

                if (report.Error.IsFatal)
                {
                    this.InvalidateProducer(report.Error, result);
                }

                context.Offset    = report.Offset;
                context.Partition = report.Partition;

                deliveryHandler(result);
            });
        }
Example #5
0
        private void InternalProduce(
            ProducerMessageContext context,
            Action <DeliveryReport <byte[], byte[]> > deliveryHandler)
        {
            this
            .EnsureProducer()
            .Produce(
                context.Topic,
                CreateMessage(context),
                report =>
            {
                if (report.Error.IsFatal)
                {
                    this.InvalidateProducer(report.Error, report);
                }

                context.Offset    = report.Offset;
                context.Partition = report.Partition;

                deliveryHandler(report);
            });
        }