2 Replies Latest reply on May 13, 2009 11:02 PM by ezanih

    Purpose of sending serializable objects across an ESB

    ezanih

      Hi there,

      I am new to JBoss ESB and I have been experimenting with the quickstart examples especially the sending of string messages across the ESB bus.

      What I would like to know is : what is the purpose of sending serialized objects (as in CreateObjectMessage rather than CreateTextMessage) across the bus?

      Could you give me some concrete examples why this would be useful ?

      How do we pick up the serializable object at the other end of the bus and access anything useful from it (such as retrieving a value or running a method of the serializable object just sent, if it was a Java class) ?

      Many thanks for your help!

        • 1. Re: Purpose of sending serializable objects across an ESB
          tfennelly

          Not quite sure what you mean. In general, this should not be an issue for most users as this is hidden away.

          ObjectMessages might be used (over TextMessages) for delivering to a JMS Gateway because you're not always sending character based payloads (XML, text etc). You could be sending e.g. Java Objects.

          • 2. Re: Purpose of sending serializable objects across an ESB
            ezanih

            Exactly! When I consider text objects being sent to and fro across the ESB bus, its easy to see the use - I mean the text could be an e-mail message or probably contain a return string from some process which could indicate success or failure or some other status or action. But I fail to see the point to transmit serialized java objects. What kind of serialized Java objects would ideally be considered for transmission across ESB. Could you give some examples please? Are you saying some objects which contain actual DATA hence a Java entity or an XML record such as the one below ?

            <?xml version = "1.0" encoding = "UTF-8"?>
            <book>
            <id>1</id>
            <title>Beginners ESB</title>
            <author>James Jonathan</author>
            <price>18.50</price>
            </book>
            


            So I would get the data for this book through some search process from the Oracle DB (for instance) and then convert it to XML and send it over the bus.

            Or perhaps a JPA Entity:

            public class Bidder implements Serializable {
            
            @Id
            @GeneratedValue
            @Column(nullable=false)
            private int id;
            private String bidderName;
            private static final long serialVersionUID = 1L;
            
            public int getId() {
            return this.id;
            }
            
            public void setId(int id) {
            this.id = id;
            }
            
            public String getBidderName() {
            return this.bidderName;
            }
            
            public void setBidderName(String bidderName) {
            this.bidderName = bidderName;
            }
            
            }
            



            But what about a session bean or a Java class with a method? I mean example, say at the front end, we have a Facelets UI or a portlet that needs some data about a book or a bidder? How does it get it over the ESB? Ok - my guess is we would send it over the ESB as a serialized object using CreateObjectMessage(Object obj). But what if the UI needed to execute a method in some Java object ? How is that done over a ESB?

            (Just a short summary will suffice, you don't have to give me link for reading as I know something about how ESB works, thanks!)

            Many thanks in advance!