Announcement Announcement Module
Collapse
No announcement yet.
Generic Payload Messaging through http Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generic Payload Messaging through http

    Hello fellow devs!

    I want to use spring-integration-http to transport a message with a object payload through different jvm's, pretty much in unidirectional fashion like this:
    Code:
    (source)channel-->http-outbound-gateway-->http-inbound-gateway-->(target)channel-->service-activator
    But apparently (this may sound dumb) I cannot transport any payload (which in my case is a value object that I've defined). Is this right?

    My goal is to have something like a message bus, with http as a transparent bridge between the channels. Do I need to provide custom HttpMessageConverter implementation to achieve that?

    thanks in advance,

    Paulo

  • #2
    Hello.

    Why can not you use RMI?

    Artem

    Comment


    • #3
      Originally posted by Cleric View Post
      Hello.

      Why can not you use RMI?

      Artem
      Basically because I didn't knew about it. I'm trying to deploy it on virgo right now, but still no success. I'll try more.

      Comment


      • #4
        Artem, may be you should point him to our samples

        Comment


        • #5
          You mean this one's:
          http://http.git.springsource.org/spr...on/samples.git
          right?
          Tks, I'm looking at it

          Comment


          • #6
            Yeah we don't really have RMI sample, but it is all based on Spring RMI (we just wrap it as adapters) http://static.springsource.org/sprin...l#remoting-rmi

            Having said that, I am not a big fan of that type of integration. In other words I would not recommend "type sharing" across JVM since too many things can go wrong. What I would recommend is "simple content sharing" where your Object is transformed into a simple String representation before transferred over the wire (e.g., JSON or XML etc.) and transformed back to the Object on the inbound side. Look at it as a much cleaner serialization then serializing Java object. It will also exposes you to a much more flexible distribution model where systems you are trying to integrate with no longer have to rely compatible version of JVM (which might be an issue during Object serialization and de-serialization depending on the complexity of your object). In fact other systems no longer have to be Java systems because your object-in-transit is now represented as structured text.

            Comment


            • #7
              Hello, Oleg.
              Yes, I couldn't find RMI-samples.

              But, according to your сomment, Paulo can do his task by http-outbound-gateway with minor step before:

              PHP Code:
              <object-to-string-transformer input-channel="in" output-channel="out"/> 
              Or somethin that can represent his object as URI variables
              Last edited by Artem Bilan; May 11th, 2011, 11:47 AM.

              Comment


              • #8
                Yes, that would be a much better solution IMHO

                Comment


                • #9
                  I'm able to do that, which works nicely. The problem is what I'm receiving in the target channel (ok, it's a Message<String>), but I could not get a god picture of it, in the way to convert in a instance on the original object. Any tips?

                  tks
                  Paulo

                  Comment


                  • #10
                    Hello.
                    And here you have to write your HttpMessageConverter, which builds your object from String.
                    But! I read the source code and did not understand that you have emerged a problem with Java serialization?
                    It is a code that must be executed on your objects:

                    Code:
                    	if (contentType == null) {
                    			contentType = new MediaType("application", "x-java-serialized-object");
                    		}
                    If you didn't setup the contentType attribute manualy:

                    Code:
                    if (httpHeaders.getContentType() == null) {

                    Comment


                    • #11
                      I was having the same problem described in this forum entry:
                      http://forum.springsource.org/showth...on-for-Integer

                      So, as a workaround, I'm converting my non-String fields of my entity into String at the value object creation, and using object-to-map-transformer/map-to-object-transformer, which pretty much resolved my problem.

                      tks for the advices,
                      Paulo

                      Comment

                      Working...
                      X