Announcement Announcement Module
No announcement yet.
Is Spring Integration right for me? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is Spring Integration right for me?

    I'm currently researching the Spring framework due to some serious appraise from a good friend. I've been checking out the different modules, and now the time has come to Integration.

    In particular, I'm interested in the XML-marshalling features of Spring. On one hand, I have a predefined database structure which I'll be accessing using Hibernate. On the other hand, I have a set of predefined XML-schemas, which serve as a basis for third party communication (the XMLs produced - conforming to said XSDs - will be transmitted to a third party using some standard protocol, e.g. http(s), smtp, etc.). The communication will be going both ways; incoming XMLs should be taken care of in a similar way. (BTW: I'm not in control of the schemas, and the db-structure is pretty fixed too.)

    My initial thought was to have JAXB produce the desired classes and then manually map these classes to the database using Hibernate. Necessary transformation code would reside at the interface between JAXB-classes and Hibernate.

    However, the situation is a rather dynamical one. The number of XSDs is growing and there might be revisions of the existing ones as well. I have no experience with Integration, but from what I understand, it could very well be the right tool for me.

    My current idea is to write a more configurable application where the actual mapping between incoming/outgoing XMLs and Hibernate is configured at runtime. The challenge is to do the necessary transformations at instances where the XML and database instances are not in a one-to-one relationship. For instance, I might have to insert two records in different tables in the database in order to process a single XML.

    Can Integration help me do this? Is there a better way using Integration (or any other part of Spring) to solve this problem? Or is Spring not the tool for the job, but you now of a smashing solution on some other platform?

    My priorities are flexibility and speed of implementing new XML/db-mappings. The overall implementation time is also of great concern.

  • #2
    I would recommend reading about Spring's Object-to-XML Marshalling/Unmarshalling support here:

    There are several implementations available out-of-the-box, including JAXB. You might be able to use that as-is or combine it with your own implementations in a way that supports different input sources.

    Spring Integration provides Message Transformer implementations that delegate to any implementation of the Marshaller/Unmarshaller interfaces. So, if you are building a Message-driven application, then you may decide to use Spring Integration as well. Or, the base Spring OXM support might be sufficient for your needs.