Announcement Announcement Module
Collapse
No announcement yet.
Help a starter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help a starter

    I'm just starting with Spring Integration and I need help with one issue. I'm going to use channels in my application and I want to know if there are any methods for accessing a channel's contents. What I want to do is to be able to somehow save objects that are in a queue in case of system shutdown. So what should I do? Should the channel class recieve some kind of event and manage its contents or should I somehow access its contents from outside and save it to disk for example?

  • #2
    Originally posted by shutyaev View Post
    I'm just starting with Spring Integration and I need help with one issue. I'm going to use channels in my application and I want to know if there are any methods for accessing a channel's contents. What I want to do is to be able to somehow save objects that are in a queue in case of system shutdown. So what should I do? Should the channel class recieve some kind of event and manage its contents or should I somehow access its contents from outside and save it to disk for example?
    If you are receiving your messages from JMS transactionally, then the message will not be acknowledged and removed from the queue until it has been successfully processed on your channel. If any exception is thrown during processing (including the server shutting down or crashing) the message will still be in the queue when your application restarts.

    Comment


    • #3
      Originally posted by chudak View Post
      If you are receiving your messages from JMS transactionally, then the message will not be acknowledged and removed from the queue until it has been successfully processed on your channel. If any exception is thrown during processing (including the server shutting down or crashing) the message will still be in the queue when your application restarts.
      Well, I'm not using JMS.. Let me explain my example. I have two beans (a producer and a consumer) and a channel (let it be QueueChannel) that connects them. Now at some time my consumer is busy handling a message and the QueueChannel has 20 more to handle. Right at the moment the user types a shutdown command for my application. To make it simple let's say I can let the consumer finish handling the current message but what I want to know is how to be with another 20 that are in the channel? I need to get them and quickly write them to the disk. How can I do that?

      Comment


      • #4
        I think, as Charles is suggesting, that JMS is worth considering for that type of requirement. In Spring Integration 2.0, we have a simple "channel" element within the "jms" namespace, so that you only have to configure a ConnectionFactory bean.

        That said, if you think it's too heavy, then you have a couple options.

        1) You could implement your own queue-based MessageChannel. See this blog for an example: http://blog.xebia.com/2009/11/27/gua...g-integration/

        2) You could use ChannelInterceptors that delegate to some data-access code.

        In 2.0, we are working on addition of a MessageStore component, so we might also provide some way to connect that to a channel (via interceptors). If you think that matches your requirement, please let us know (here or via JIRA).

        I do have one more question though. Do you really need to be buffering those Messages in the channel between your producer and consumer in the first place? Could you possibly handle this with concurrent threads for the consumer's message processing?

        Comment


        • #5
          Well, the truth is I don't really know what I need. You see I'm working on a diploma project at my university and I chose Spring Integration as a base for it. Maybe if I give you my problem you will make my thoughts clear =)

          The task is to develop an integration environment. I almost developed my own but then I found out about OSGi and then about Spring Integration and I thought "wow! the thing is already developed". However the diploma is the diploma so I need to develop something myself. And here's what I thought about.

          1) I want to separate two kinds work (and two kinds of developers) from each other.

          The first ones are the architects who deal with the whole application and develop diagrams such as this (http://static.springsource.org/sprin.../cafe-demo.png) The result of their work is Spring XML Configuration file. I will develop a graphical editor (based on Eclipse GMF) that shows all the kinds of beans and channels and allows to set their properties.

          The second ones are the programmers who develop generic or application-specific beans. They also develop some kind of description (via Annotations for example) of their beans that allows the architects to see what properties do these components have.

          2) When the configuration is deployed (to the dm server) the configuration editor switches to runtime mode where you cannot change the configuration but you can control and monitor your system:
          * see what objects are in the queues
          * start/stop any bean, update a bean with a new version
          * start/stop the whole system
          * view log files

          NB: the system must be failsafe so when it shuts down all messages in queues must be saved to disk and restored on restart.

          3) One of the goals is that end-users need to know nothing about OSGi, Spring Integration etc. The architects just visualize the integration processes and the programmers just write some methods in plain Java (and maybe add some annotations).

          I would be very grateful if you would comment on this and make my thoughts clear, 'cause I'm kind of a newbie in both Spring and OSGi. =)

          Comment


          • #6
            I think you just described STS 2.3. Maybe you can extend that a bit with a nicer graphical view of the Spring Integration context (now it doesn't show endpoints and channels very clearly). To be fair to you, you should keep a tab on the developments around IntelliJ 10 and STS 2.4. It could be a nasty surprise if one of these boasted full graphical support for Spring Integration before you were done.

            One thing that bugs me about your assignment is that you seem to be under the impression that the architects and developers should be in different teams. This is a dangerous and old fashioned viewpoint imo. Maybe you can pick a fight with your professor over this .

            Don't give up, you've got a crazy cool assignment. The fact that the foundation is already there and that you've found it is all good news.

            If you publish anything please share!

            Comment

            Working...
            X