Announcement Announcement Module
Collapse
No announcement yet.
custom event driven channel adaptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • custom event driven channel adaptor

    Hi,
    Can anyone point me to a guide or examples of how to create a custom event driven inbound channel adaptor?

  • #2
    Can you please provide more details. "custom event driven inbound channel adaptor" - what is custom and what event and where is it coming from? Are you talking about Spring events?

    Comment


    • #3
      Sure, I'm using a tailable cursor in Mongo to receive updates carried out on a collection, sort of like a RDBMS trigger. The cursor blocks while the collection is not being updated.

      The code I have working at the moment looks like this

      while (true) {
      try {
      BasicDBObject doc = (BasicDBObject)_tailableCursor.nextDoc();

      Message<BasicDBObject> message = MessageBuilder.withPayload(doc).build();
      _sendChannel.send(message);

      } catch (final InterruptedException ie) {
      ....
      }
      }


      It would be nice to wrap the setup and execution into an adaptor. I was thinking of using a standard java util event where the message is being built but if there is a better way of doing this that's great.

      Comment


      • #4
        Actually you are in luck as we are in the process of writing Mongo and Redis adapter (set to merge this week, so it wil be available in the snapshot) that will do the same thing. For Mongo there is already a PR from one of our community contributor that I need to review https://github.com/SpringSource/spri...ation/pull/558 but feel free to jump in an see what els it may need.

        Comment


        • #5
          Hi,

          Also, in case you are interested in creating adapters more generally: for STS 3.0.0.M3 we just added a new Adapter Template that should provide you with a good foundation for creating your own custom Spring Integration components.

          The new Adapter Template creates a fully functional Spring Integration module including namespace support. The template will create the following components:
          1. inbound-channel-adapter
          2. outbound-channel-adapter
          3. outbound-gateway

          In order to check this out, please download STS 3.0.0.M3, keep in mind that the Adapter Template uses Gradle. Therefore, please make sure that your installation of STS has the Gradle support installed.

          Steps for creating a custom adapter template:
          1. Go File --> New --> Spring Template Project
          2. The Template Selection screen will appear
          3. Select Integration --> Spring Integration Adapter Template Project
          4. Press Next
          5. Fill out the details of your project
          6. Press Finish

          In terms of supported Gradle tasks, the generated template project provides mostly the same tasks as Spring Integration.

          I hope this provides some additional useful information.

          Cheers,

          Gunnar

          Comment


          • #6
            Originally posted by oleg.zhurakousky View Post
            Actually you are in luck as we are in the process of writing Mongo and Redis adapter (set to merge this week, so it wil be available in the snapshot) that will do the same thing. For Mongo there is already a PR from one of our community contributor that I need to review https://github.com/SpringSource/spri...ation/pull/558 but feel free to jump in an see what els it may need.
            Thanks, are there any specs for the mongo input adapter l see work hasn't started on this yet. I guess what I'm doing is probably closer to Redis PUB/SUB functionality than standard polling a collection but would be interesting to have a look

            Comment


            • #7
              Do you have your code somewhere or can you post it somewhere?
              The work for inbound is started but not committed yet, should be soon

              Comment


              • #8
                Originally posted by ghillert View Post
                Hi,

                Also, in case you are interested in creating adapters more generally: for STS 3.0.0.M3 we just added a new Adapter Template that should provide you with a good foundation for creating your own custom Spring Integration components.

                The new Adapter Template creates a fully functional Spring Integration module including namespace support. The template will create the following components:
                1. inbound-channel-adapter
                2. outbound-channel-adapter
                3. outbound-gateway

                In order to check this out, please download STS 3.0.0.M3, keep in mind that the Adapter Template uses Gradle. Therefore, please make sure that your installation of STS has the Gradle support installed.

                Steps for creating a custom adapter template:
                1. Go File --> New --> Spring Template Project
                2. The Template Selection screen will appear
                3. Select Integration --> Spring Integration Adapter Template Project
                4. Press Next
                5. Fill out the details of your project
                6. Press Finish

                In terms of supported Gradle tasks, the generated template project provides mostly the same tasks as Spring Integration.

                I hope this provides some additional useful information.

                Cheers,

                Gunnar
                Thanks Gunnar. This is great will give it a go

                Comment


                • #9
                  Unfortunately I'm behind a firewall and not allowed to post my code, but there isn't much to it you can see a C++ and javascript version here
                  http://www.mongodb.org/display/DOCS/Tailable+Cursors

                  Comment


                  • #10
                    Unfortunately (to the best of my knowledge) there is no support for this type of cursor in spring data mongo. I'll do a bit more analysis on this and look at including support around this in both spring data mongo and SI. I had seen apache camel implementing it in their mongodb component.

                    This is the latest PR for the mongo adapter. Feel free to raise a JIRA for the tailable cursor feature you want.

                    I'll keep you'll updated on it.

                    Thanks
                    Last edited by Amol Nayak; Aug 2nd, 2012, 06:34 AM.

                    Comment


                    • #11
                      Hi

                      I generated the adapter template from scratch - new installation of M3 and everything, but the spring, junit dependencies are all unresolved. Red lines all over the place in the project.

                      Do I have to configure those manually?

                      Thanks,
                      Simon

                      Comment

                      Working...
                      X