示例#1
0
        public KafkaWriter(ProducerConfig config)
        {
            var producerBuilder = new ProducerBuilder <string, byte[]>(config);

            _producer = producerBuilder.Build();
            _debug    = Log.IsDebugEnabled() ? Log.Debug : null;
            _route    = x => DefaultRouters.RouteByCategory(x.EventDetails.Stream);
        }
示例#2
0
            static MessageRoute AsRoute(JsValue result, TransformEvent evt)
            {
                if (result == null || result.IsUndefined() || !result.IsObject())
                {
                    return(DefaultRouters.RouteByCategory(evt.Stream));
                }

                var obj = result.AsObject();

                return(new MessageRoute(
                           obj.Get("topic").AsString(),
                           obj.Get("partitionKey").AsString()
                           ));
            }