You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Krish <kr...@gmail.com> on 2016/06/23 09:45:50 UTC

Expired messages in kafka topic

Hi,
I am trying to design a real-time application where message timeout can be
as low as a minute or two (message can get stale real-fast).

In the rare chance that the consumers lag too far behind in processing
messages from the broker, is there a concept of expired message queue in
Kafka?

I would like to know if a message has expired and then park it in some
topic till as such time that a service can dequeue, process it and/or
investigate it.

Thanks.

Best,
Krish

Re: Expired messages in kafka topic

Posted by Krish <kr...@gmail.com>.
Tom,
When you say this:
"Deletion can happen at different times on the different replicas of the
log, and to different messages. Whilst a consumer will only be reading from
the lead broker for any log at any one time, the leader can and will change
to handle broker failure."

basically it means that a dead-letter Q like functionality can get multiple
messages, and anyone draining the queue needs to take care of duplicates.
Right so far?




--
κρισhναν

On Thu, Jun 23, 2016 at 9:21 PM, Krish <kr...@gmail.com> wrote:

> Well, we are already using Kafka and would like to get this feature.
> How hard can it be to hack it and use a custom kafka!? ;)
>
> Let me look up the source code (never have checked it) and see what can be
> done.
> Thanks Tom and Christian, for helping me decide fast.
>
>
>
> --
> κρισhναν
>
> On Thu, Jun 23, 2016 at 9:16 PM, Christian Posta <
> christian.posta@gmail.com> wrote:
>
>> Sounds like something a traditional message broker (ie, ActiveMQ) would
>> be able to do with a TTL setting and expiry. Expired messages get moved to
>> a DLQ.
>>
>> On Thu, Jun 23, 2016 at 2:45 AM, Krish <kr...@gmail.com> wrote:
>>
>>> Hi,
>>> I am trying to design a real-time application where message timeout can
>>> be
>>> as low as a minute or two (message can get stale real-fast).
>>>
>>> In the rare chance that the consumers lag too far behind in processing
>>> messages from the broker, is there a concept of expired message queue in
>>> Kafka?
>>>
>>> I would like to know if a message has expired and then park it in some
>>> topic till as such time that a service can dequeue, process it and/or
>>> investigate it.
>>>
>>> Thanks.
>>>
>>> Best,
>>> Krish
>>>
>>
>>
>>
>> --
>> *Christian Posta*
>> twitter: @christianposta
>> http://www.christianposta.com/blog
>> http://fabric8.io
>>
>>
>

Re: Expired messages in kafka topic

Posted by Krish <kr...@gmail.com>.
Well, we are already using Kafka and would like to get this feature.
How hard can it be to hack it and use a custom kafka!? ;)

Let me look up the source code (never have checked it) and see what can be
done.
Thanks Tom and Christian, for helping me decide fast.



--
κρισhναν

On Thu, Jun 23, 2016 at 9:16 PM, Christian Posta <ch...@gmail.com>
wrote:

> Sounds like something a traditional message broker (ie, ActiveMQ) would be
> able to do with a TTL setting and expiry. Expired messages get moved to a
> DLQ.
>
> On Thu, Jun 23, 2016 at 2:45 AM, Krish <kr...@gmail.com> wrote:
>
>> Hi,
>> I am trying to design a real-time application where message timeout can be
>> as low as a minute or two (message can get stale real-fast).
>>
>> In the rare chance that the consumers lag too far behind in processing
>> messages from the broker, is there a concept of expired message queue in
>> Kafka?
>>
>> I would like to know if a message has expired and then park it in some
>> topic till as such time that a service can dequeue, process it and/or
>> investigate it.
>>
>> Thanks.
>>
>> Best,
>> Krish
>>
>
>
>
> --
> *Christian Posta*
> twitter: @christianposta
> http://www.christianposta.com/blog
> http://fabric8.io
>
>

Re: Expired messages in kafka topic

Posted by Krish <kr...@gmail.com>.
Hi,
I am trying to set up a kafka dev environment for the past few days.
I followed this
<https://developer.ibm.com/opentech/2016/06/06/how-to-develop-for-apache-kafka-using-eclipse/>
link; the only difference being that I downloaded the latest scala IDE,
instead of Eclipse.

Any pointers to resolved this please.



--
κρισhναν

On Thu, Jun 23, 2016 at 11:06 PM, Krish <kr...@gmail.com> wrote:

> Gwen,
> Have selected priority 'minor', component as 'core', have assigned no
> labels.
> Jira link: https://issues.apache.org/jira/browse/KAFKA-3895.
>
> I have also added a question to the jira issue, alongwith a rough approach
> that I have in mind.
> It would be great if you can have a look and provide comments.
>
> I am still setting up the dev env for kafka; will update as I progress.
> Thanks.
>
>
>
> --
> κρισhναν
>
> On Thu, Jun 23, 2016 at 9:30 PM, Gwen Shapira <gw...@confluent.io> wrote:
>
>> Thats a pretty cool feature, if anyone feels like opening a JIRA :)
>>
>> On Thu, Jun 23, 2016 at 8:46 AM, Christian Posta
>> <ch...@gmail.com> wrote:
>> > Sounds like something a traditional message broker (ie, ActiveMQ) would
>> be
>> > able to do with a TTL setting and expiry. Expired messages get moved to
>> a
>> > DLQ.
>> >
>> > On Thu, Jun 23, 2016 at 2:45 AM, Krish <kr...@gmail.com>
>> wrote:
>> >
>> >> Hi,
>> >> I am trying to design a real-time application where message timeout
>> can be
>> >> as low as a minute or two (message can get stale real-fast).
>> >>
>> >> In the rare chance that the consumers lag too far behind in processing
>> >> messages from the broker, is there a concept of expired message queue
>> in
>> >> Kafka?
>> >>
>> >> I would like to know if a message has expired and then park it in some
>> >> topic till as such time that a service can dequeue, process it and/or
>> >> investigate it.
>> >>
>> >> Thanks.
>> >>
>> >> Best,
>> >> Krish
>> >>
>> >
>> >
>> >
>> > --
>> > *Christian Posta*
>> > twitter: @christianposta
>> > http://www.christianposta.com/blog
>> > http://fabric8.io
>>
>
>

Re: Expired messages in kafka topic

Posted by Krish <kr...@gmail.com>.
Gwen,
Have selected priority 'minor', component as 'core', have assigned no
labels.
Jira link: https://issues.apache.org/jira/browse/KAFKA-3895.

I have also added a question to the jira issue, alongwith a rough approach
that I have in mind.
It would be great if you can have a look and provide comments.

I am still setting up the dev env for kafka; will update as I progress.
Thanks.



--
κρισhναν

On Thu, Jun 23, 2016 at 9:30 PM, Gwen Shapira <gw...@confluent.io> wrote:

> Thats a pretty cool feature, if anyone feels like opening a JIRA :)
>
> On Thu, Jun 23, 2016 at 8:46 AM, Christian Posta
> <ch...@gmail.com> wrote:
> > Sounds like something a traditional message broker (ie, ActiveMQ) would
> be
> > able to do with a TTL setting and expiry. Expired messages get moved to a
> > DLQ.
> >
> > On Thu, Jun 23, 2016 at 2:45 AM, Krish <kr...@gmail.com>
> wrote:
> >
> >> Hi,
> >> I am trying to design a real-time application where message timeout can
> be
> >> as low as a minute or two (message can get stale real-fast).
> >>
> >> In the rare chance that the consumers lag too far behind in processing
> >> messages from the broker, is there a concept of expired message queue in
> >> Kafka?
> >>
> >> I would like to know if a message has expired and then park it in some
> >> topic till as such time that a service can dequeue, process it and/or
> >> investigate it.
> >>
> >> Thanks.
> >>
> >> Best,
> >> Krish
> >>
> >
> >
> >
> > --
> > *Christian Posta*
> > twitter: @christianposta
> > http://www.christianposta.com/blog
> > http://fabric8.io
>

Re: Expired messages in kafka topic

Posted by Gwen Shapira <gw...@confluent.io>.
Thats a pretty cool feature, if anyone feels like opening a JIRA :)

On Thu, Jun 23, 2016 at 8:46 AM, Christian Posta
<ch...@gmail.com> wrote:
> Sounds like something a traditional message broker (ie, ActiveMQ) would be
> able to do with a TTL setting and expiry. Expired messages get moved to a
> DLQ.
>
> On Thu, Jun 23, 2016 at 2:45 AM, Krish <kr...@gmail.com> wrote:
>
>> Hi,
>> I am trying to design a real-time application where message timeout can be
>> as low as a minute or two (message can get stale real-fast).
>>
>> In the rare chance that the consumers lag too far behind in processing
>> messages from the broker, is there a concept of expired message queue in
>> Kafka?
>>
>> I would like to know if a message has expired and then park it in some
>> topic till as such time that a service can dequeue, process it and/or
>> investigate it.
>>
>> Thanks.
>>
>> Best,
>> Krish
>>
>
>
>
> --
> *Christian Posta*
> twitter: @christianposta
> http://www.christianposta.com/blog
> http://fabric8.io

Re: Expired messages in kafka topic

Posted by Christian Posta <ch...@gmail.com>.
Sounds like something a traditional message broker (ie, ActiveMQ) would be
able to do with a TTL setting and expiry. Expired messages get moved to a
DLQ.

On Thu, Jun 23, 2016 at 2:45 AM, Krish <kr...@gmail.com> wrote:

> Hi,
> I am trying to design a real-time application where message timeout can be
> as low as a minute or two (message can get stale real-fast).
>
> In the rare chance that the consumers lag too far behind in processing
> messages from the broker, is there a concept of expired message queue in
> Kafka?
>
> I would like to know if a message has expired and then park it in some
> topic till as such time that a service can dequeue, process it and/or
> investigate it.
>
> Thanks.
>
> Best,
> Krish
>



-- 
*Christian Posta*
twitter: @christianposta
http://www.christianposta.com/blog
http://fabric8.io

Re: Expired messages in kafka topic

Posted by Tom Crayford <tc...@heroku.com>.
No, there's no control over that. The right way to do this is to keep up
with the head of the topic and decide on "old" yourself in the consumer.

Deletion can happen at different times on the different replicas of the
log, and to different messages. Whilst a consumer will only be reading from
the lead broker for any log at any one time, the leader can and will change
to handle broker failure.

On Thu, Jun 23, 2016 at 4:37 PM, Krish <kr...@gmail.com> wrote:

> Thanks Tom.
> Is there any way a consumer can be triggered when the message is about to
> be deleted by Kafka?
>
>
>
> --
> κρισhναν
>
> On Thu, Jun 23, 2016 at 6:16 PM, Tom Crayford <tc...@heroku.com>
> wrote:
>
>> Hi,
>>
>> A pretty reasonable thing to do here would be to have a consumer that
>> moved "old" events to another topic.
>>
>> Kafka has no concept of an expired queue, the only thing it can do once a
>> message is aged out is delete it. The deletion is done in bulk and
>> typically is set to 24h or even higher (LinkedIn use 4 days, the default is
>> 7 days).
>>
>> Thanks
>>
>> Tom Crayford
>> Heroku Kafka
>>
>> On Thu, Jun 23, 2016 at 10:45 AM, Krish <kr...@gmail.com>
>> wrote:
>>
>>> Hi,
>>> I am trying to design a real-time application where message timeout can
>>> be
>>> as low as a minute or two (message can get stale real-fast).
>>>
>>> In the rare chance that the consumers lag too far behind in processing
>>> messages from the broker, is there a concept of expired message queue in
>>> Kafka?
>>>
>>> I would like to know if a message has expired and then park it in some
>>> topic till as such time that a service can dequeue, process it and/or
>>> investigate it.
>>>
>>> Thanks.
>>>
>>> Best,
>>> Krish
>>>
>>
>>
>

Re: Expired messages in kafka topic

Posted by Krish <kr...@gmail.com>.
Thanks Tom.
Is there any way a consumer can be triggered when the message is about to
be deleted by Kafka?



--
κρισhναν

On Thu, Jun 23, 2016 at 6:16 PM, Tom Crayford <tc...@heroku.com> wrote:

> Hi,
>
> A pretty reasonable thing to do here would be to have a consumer that
> moved "old" events to another topic.
>
> Kafka has no concept of an expired queue, the only thing it can do once a
> message is aged out is delete it. The deletion is done in bulk and
> typically is set to 24h or even higher (LinkedIn use 4 days, the default is
> 7 days).
>
> Thanks
>
> Tom Crayford
> Heroku Kafka
>
> On Thu, Jun 23, 2016 at 10:45 AM, Krish <kr...@gmail.com> wrote:
>
>> Hi,
>> I am trying to design a real-time application where message timeout can be
>> as low as a minute or two (message can get stale real-fast).
>>
>> In the rare chance that the consumers lag too far behind in processing
>> messages from the broker, is there a concept of expired message queue in
>> Kafka?
>>
>> I would like to know if a message has expired and then park it in some
>> topic till as such time that a service can dequeue, process it and/or
>> investigate it.
>>
>> Thanks.
>>
>> Best,
>> Krish
>>
>
>

Re: Expired messages in kafka topic

Posted by Tom Crayford <tc...@heroku.com>.
Hi,

A pretty reasonable thing to do here would be to have a consumer that moved
"old" events to another topic.

Kafka has no concept of an expired queue, the only thing it can do once a
message is aged out is delete it. The deletion is done in bulk and
typically is set to 24h or even higher (LinkedIn use 4 days, the default is
7 days).

Thanks

Tom Crayford
Heroku Kafka

On Thu, Jun 23, 2016 at 10:45 AM, Krish <kr...@gmail.com> wrote:

> Hi,
> I am trying to design a real-time application where message timeout can be
> as low as a minute or two (message can get stale real-fast).
>
> In the rare chance that the consumers lag too far behind in processing
> messages from the broker, is there a concept of expired message queue in
> Kafka?
>
> I would like to know if a message has expired and then park it in some
> topic till as such time that a service can dequeue, process it and/or
> investigate it.
>
> Thanks.
>
> Best,
> Krish
>