kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clebert Suconic <clebert.suco...@gmail.com>
Subject [DISCUSS] URIs on Producer and Consumer
Date Tue, 03 Oct 2017 18:45:37 GMT
I believe I need write access to the WIKI Page:


https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Improvement+Proposals

As I don't see the KIP Template..


If anyone could please include me the to the group please?




On Tue, Oct 3, 2017 at 9:23 AM, Christopher Shannon
<christopher.l.shannon@gmail.com> wrote:
> I think this would be useful as a secondary way to configure.  If others
> agree then you can write up a KIP and it can be discussed in more detail.
>
> On Tue, Oct 3, 2017 at 8:56 AM, Clebert Suconic <clebert.suconic@gmail.com>
> wrote:
>
>> Maybe I didn't make the message clear enough...
>>
>> Would using an URI to the constructor (in addition to the properties)
>> help the API, or anyone see a reason to not do it?
>>
>> KafkaConsumer consumer = new
>> KafkaConsumer<>("tcp://localhost:9999?receive.buffer.bytes=-2", new
>> ByteArrayDeserializer(), new ByteArrayDeserializer());
>>
>> I could send a Pull Request for that. The framework I would write
>> would validate if the parameters are valid or not.
>>
>>
>> Thanks in advance
>>
>>
>> On Mon, Oct 2, 2017 at 9:14 AM, Clebert Suconic
>> <clebert.suconic@gmail.com> wrote:
>> > At ActiveMQ and ActiveMQ Artemis, ConnectionFactories have an
>> > interesting feature where you can pass parameters through an URI.
>> >
>> > I was looking at Producer and Consumer APIs, and these two classes are
>> > using a method that I considered old for Artemis resembling HornetQ:
>> >
>> > Instead of passing a Properties (aka HashMaps), users would be able to
>> > create a Consumer or Producer by simply doing:
>> >
>> > new Consumer("tcp::/host:port?properties=values;properties=
>> values...etc");
>> >
>> > Example:
>> >
>> >
>> > Instead of the following:
>> >
>> > Map<String, Object> config = new HashMap<>();
>> > config.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
>> > config.put(ConsumerConfig.RECEIVE_BUFFER_CONFIG, -2);
>> > new KafkaConsumer<>(config, new ByteArrayDeserializer(), new
>> > ByteArrayDeserializer());
>> >
>> >
>> >
>> > Someone could do
>> >
>> > new KafkaConsumer<>("tcp://localhost:9999?receive.buffer.bytes=-2",
>> > new ByteArrayDeserializer(), new ByteArrayDeserializer());
>> >
>> >
>> >
>> > I don't know if that little API improvement would be welcomed? I would be
>> > able to send a Pull Request but I don't want to do it if that wouldn't
>> > be welcomed in the first place:
>> >
>> >
>> > Just an idea...  let me know if that is welcomed or not.
>> >
>> > If so I can forward the discussion into how I would implement it.
>>
>>
>>
>> --
>> Clebert Suconic
>>



-- 
Clebert Suconic

Mime
View raw message