Results 1 to 2 of 2

Thread: Two Target channel with same ID

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Posts
    110

    Default Two Target channel with same ID

    Hi, im trying to do next thing. I have an String that is send into MessageBus, after some MessageEndpoints, i want that String content is copied inside two directories. I have used next configuration:

    Code:
    <channel id="outputFile"></channel>
    
    	<file-target id="logFile" directory="C:\\Temp" channel="outputFile"/>
    	<file-target id="log2file" directory="C:\\Temp2" channel="outputFile"/>
    And then in Splitter i have next output channel:

    Code:
    @Splitter(channel = "outputFile")
    If only one file target is present, the example works perfectly, but when two file-targets are configured, only first file-target seems to work. Is it the expected behaviour? How can i make to write twice the same information?

    Thank you very much.

    PD: If you want i can upload the code.
    Si em veiessin caminar per sobre un llac, dirien que no sé nedar.
    http://alexsotob.blogspot.com

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    By default, channels have "point-to-point" semantics. This means that only one consumer should receive the message. If more than one endpoint is registered as a subscriber to a point-to-point channel, then all such endpoints act as "competing consumers". The first one that is able to accept the message will handle it.

    You should be able to simply modify your channel to have "publish-subscribe" behavior instead by adding the "publish-subscribe" attribute to the channel definition:
    Code:
    <channel id="outputFile" publish-subscribe="true"/>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •