Results 1 to 7 of 7

Thread: Programming using Spring Integration API

  1. #1
    Join Date
    Aug 2009
    Posts
    11

    Default 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. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    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

  3. #3
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default

    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) ?

  4. #4
    Join Date
    Aug 2009
    Posts
    11

    Default

    Quote 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.

  5. #5
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    @ 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");

  6. #6
    Join Date
    Aug 2009
    Posts
    11

    Default

    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

  7. #7
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default

    Thanks Oleg

Posting Permissions

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