Announcement Announcement Module
Collapse
No announcement yet.
Programming using Spring Integration API Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programming using Spring Integration API

    Hi all,

    I am quite new to Spring Integration, which is by the way an excellent integration tool.

    I have managed to use spring integration using configurations via the applicationContext.xml.

    Now, what I want to do is to create things dynamically using the underlying API (eg: to add more consumers to a queue on the fly). I know that it can be done (the main SI site says so too) but I have found nothing which can provide me on help to do so.

    Can someone please point me to a few examples or some form of reference?

    Thanks.
    Chris

  • #2
    There are several things you can do.
    1. If you read documentation, there are many references throughout to how to use SI API (both non-POJO way by implementing specific interfaces as well as the annotation way of doing it)
    2. Check out SI samples, they are all Mavenized and are simple to execute (should get you up and running in less then 5 min)
    3. If you check out SI source, you can look at many test cases to get even deeper into usage of SI API
    4. If you have a specific question about specific component of SI feel free to post it here
    Cheers

    Comment


    • #3
      I had a question on the same lines.

      My use case is i want to activate a channel based on some configuration(property files) that is my bundle(exchange channel) with channel definitions and inbound jms adapters.

      My exchange bundle is common piece of code , when deployment in some cases i do not want the channel to exist and in some cases i want them to exist.

      Can i achieve this using spring xml configuration(by passing some property to channel) or
      Should i use spring integration api's to define my channel based on configuration(property files) ?

      Comment


      • #4
        Originally posted by oleg.zhurakousky View Post
        There are several things you can do.
        1. If you read documentation, there are many references throughout to how to use SI API (both non-POJO way by implementing specific interfaces as well as the annotation way of doing it)
        2. Check out SI samples, they are all Mavenized and are simple to execute (should get you up and running in less then 5 min)
        3. If you check out SI source, you can look at many test cases to get even deeper into usage of SI API
        4. If you have a specific question about specific component of SI feel free to post it here
        Cheers
        Thanks for you help Oleg

        I have managed to achieve what I wanted ... at least up till now.

        Comment


        • #5
          @ sudheerk84

          First to create channel programmatically (there are many different types) you can refer to this chapter of reference manual: http://static.springsource.org/sprin...mplementations

          At the end of the day Message Channel is just a bean which means your question is really about: Can I register a bean dynamically?
          Yes you can and there are more then one way of doing it and they depend on when do you know about weather you need to create a cannel or not?
          For example if you know about the need for a channel during the initialization phase of ApplicationContext, then you can register BeanFactoryPostProcessor and have it create and register definition of a bean (channel).
          If realization for a channel comes at the usage phase of ApplicationContext, then you can get the reference to ApplicationConetxt and register newly created channel:
          Code:
          MessageChannel myChannel = . . .
          ((ConfigurableApplicationContext)ac.getBeanFactory()).registerSingleton(myChannel, "myChannel");

          Comment


          • #6
            Hi again Oleg,

            Here is one question for you ...
            I want to create a message-driven jms consumer (using the 'onMessage' method).

            Reason is that in the class 'ChannelPublishingJmsListener' there doesn't seem any way to bing a JMS queue with an underlying channel.

            Any help would be greatly appreciated.


            Regards
            Chris

            Comment


            • #7
              Thanks Oleg

              Comment

              Working...
              X