Announcement Announcement Module
Collapse
No announcement yet.
Use target object in filter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use target object in filter

    Hi community,

    I search a way to provide the reference of a subscriber to an filter.
    My use case : I want accept the message according to some constraints represented by annotations in my "endpoint service".
    My thought is to make it in my filter, for that, the "soucribtable channel" inserts automatically the reference of target service in the message provided (for each subscribers) during the dispatch.

    it's an correct approach or i'm wrong ?

    All the best,

  • #2
    I am not sure I understand your use case. . .
    In any event, injecting subscriber into a filter would be the same as injecting any Spring-configured bean into one another.
    However. . .
    Realize that by injecting subscriber into a filter you risking coupling several integration concerns with some business concerns. Filter is only to filter (guard) messages between two channels so the endpoint listening on the "other side" receives only what was intended to receive and therefore doesn't have to filter any messages.
    If you want to filter and send messages to different subscribers based on the type of message, you might want to look at the ROUTER component which allow you to route messages to different subscribers based on various aspects of the message (e.g., headers, payload type etc...)

    Comment


    • #3
      Hi,

      Thank for your response,
      Ok ,The goal of Filter is to accept (or not) the message, but, a Filter can be “generic” and to take the task to inspect a simple"Object" instance ,provided by the message, in order to get annotations to perform externalized business rules.

      In my opinion,I don't think that increase the coupling of integration and the business, if, the annotations are abstracts constraints,the Filter is based on an external service to perform the condition (accept or not) ,and, it does not know the algorithm to accept the message.
      His unique job, recognize a few annotations and provide them to a simple business solver.

      It's possible to make that easily with AOP or directly in my code side with a specific heritage, but a Filter can have ,also, a reference on a special context which contains just annotations of the target subscriber.

      All the best,
      Last edited by ZLm; Jan 16th, 2010, 11:09 AM.

      Comment

      Working...
      X