Duplicate Message Filtering

Multiple Event Instances Filtering

Technical Complexity

Simple

Purpose

  • Allow the listener to not have to manage possible multiple instances of the same event.

Situation

  • A machine is being detected as down. A periodic check is done, and each time the check is done, an event is sent. But the event listener is only interested in one instance of the event for the down state (at most once).
  • An ATM allows for money withdrawal. But to avoid rapid fire events, only one withdrawal event is allowed on a single account every 10 seconds.

Design

The notion of filtering multiple copies of the same event on a stream can be rephrased as, not having the same event twice in a row. While not being ground breaking, this change in wording allow us to do the following, if we have ON event and OFF event, and the inbound stream looks like:

[ON,ON,ON,OFF,OFF,OFF,OFF,ON,OFF,OFF,...] and what we want to send out is

[ON,OFF,ON,OFF,....]

We basically show a two state event. So, if we have a sliding window of 2 just to keep the last two events:

  • From [ON,ON] being the last two events, we know we only want [ON],
  • Same with [OFF,OFF] we only want [OFF].
  • But if we have [ON,OFF] or [OFF,ON] as the last two, we will want to see then both.

 So in short, we want the last two event, that are distinct from one another.

To be able to forward this to a stream, we have to use  a stream converter. For this case we want the new event that would be inserted in the stream. So, out of the distinct, we would get the last entry in relation, and put it into the outbound stream.

IEP Constructs Used

Process Flow


 

  • Inbound stream
  • Stream to Relation Tuple Window Converter
  • Distinct Relation
  • Inserted Event Relation to Stream Converter
  • Outbound Stream

Tuple Window Converter



Sample Files

Example Limitations

Labels

type-howto type-howto Delete
medium-document medium-document Delete
container-jbi container-jbi Delete
component-iepse component-iepse Delete
component-serviceengine component-serviceengine Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact