7 Replies Latest reply on Aug 17, 2008 2:00 PM by ron_sigal

    sending Streams using POJOS

    clarich

      I would like to know if it is possible to send Streams (e.g. as return Values) when using POJOS. Especially I am interested in sending Streams from a Server to a Client. When I try it out, I run into an UndeclaredThrowableException. Are there any workarounds for it? If it is not possible to send Streams this way, I would like to know, if this is an issue to be integrated into future versions of Remoting.

        • 1. Re: sending Streams using POJOS

          Currently, there is no way for a server to send a stream to the client. I also don't see anything on the road map for it. If would like to create a feature request in jira (http://jira.jboss.com), then will assign to a release.

          • 2. Re: sending Streams using POJOS
            caultonpos

            Tom, this feature of streaming a file from the server to the client is very important for my application. I have a Swing fat client with many use cases whereby I need to exchange images or file attachments with the server over RMI.

            To upload files your implementation was elegant and testing GB files works very well.

            remotingClient = new Client(new InvokerLocator(streamLocatorURL));
            remotingClient.connect();
            remotingClient.invoke(fileInput, file.getFilePath());

            I do not store these files in the database (they could be up 150MB in size). Rather I store in a filesystem with the database containing the meta data - file device, name, location, size, etc.

            I need these files back of course so I need the reverse of your upload
            i.e.
            OutputStream out = ... (ByteArrayOutputStream or FileOutputStream as needed)
            remotingClient = new Client(new InvokerLocator(streamLocatorURL));
            remotingClient.connect();
            remotingClient.invoke(fileOutput, parameter);

            In my case the parameter will be the primary key to the meta data so that the server can find the file. As in the upload, just providing an Object parameter is fine for me.

            On the server I would implement:

            public Object handleStream(OutputStream stream, InvocationRequest param);

            I use the param to find the file and write the file to the stream.

            Let me know if this is feasible, I would love to see this out before the end of the year - the alternatives are not pretty - return the byte[] of the entire file (obvious performance issue) or setup some kind of ftp service bean but all sorts of security issues there.

            I'm not sure what other alternatives I have.

            I will log a Jira referencing this thread

            thanks!

            Greg

            • 3. Re: sending Streams using POJOS
              ron_sigal

              Hi Claudia and Greg,

              I see JIRA issue JBREM-661 "Allow server sending a stream to the client" currently assigned to the Remoting 2.4.0 release.

              It's a nice feature, and I hope we can get to it. We're gearing up for a major rewrite of Remoting, so I can't promise, but we'll try.

              -Ron

              • 4. Re: sending Streams using POJOS
                caultonpos

                Hi Ron,

                I see this issue was assigned to remoting 2.4.1. Am I correct in that this is not available yet - looks like it is still unresolved?

                JBREM 661 https://jira.jboss.org/jira/browse/JBREM/fixforversion/12311977

                I am writing an open source healthcare information system and this feature is fairly critical to performance. I expect I could write my own file streaming service but that is very undesirable - especially as the JBoss streaming in the other direction works so well.

                Is there any way I can sponsor development of this feature (if I can afford it).

                thanks!

                Greg

                http://www.patientos.org

                • 5. Re: sending Streams using POJOS
                  ron_sigal

                  Hi Greg,

                  First of all, thank you for your interest in Remoting.

                  The fact is that the 2.x family of Remoting releases is reaching the end of its development life. The next major Remoting release should be 3.0.0.GA, and it's quite likely that there will never be a 2.4.1.

                  The good news is that Remoting 3 will support a flexible and symmetric streaming model.

                  We're now directing all of our resources to Remoting 3, so I can't really offer the possibility of diverting time to Remoting 2.

                  Of course, we would certainly consider the possibility of accepting contributions, if you have the development resources. By the way, you might want to check out the "remoting streams" thread in the "Design of JBoss Remoting, Unified Invokers" forum at http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101558#4101558.

                  I hope we won't lose you as a Remoting user, but, well, reality is formidable.

                  -Ron

                  • 6. Re: sending Streams using POJOS
                    caultonpos

                    Will I be able to use Remoting 3 with Jboss 4.2 ? Do you have a rough date as to when it will be available?

                    thanks!

                    Greg

                    • 7. Re: sending Streams using POJOS
                      ron_sigal

                      Hi Greg,

                      "caultonpos" wrote:

                      Will I be able to use Remoting 3 with Jboss 4.2 ?


                      Yes, we intend for Remoting 3 to be wire and API compatible with Remoting 2. Remoting 3 is really targeted to Application Server 5, though, so I don't know whether Remoting 3 will ever ship (and be tested with) some future version of AS 4.2.

                      "caultonpos" wrote:

                      Do you have a rough date as to when it will be available?


                      The scheduling is still rather fluid, but Remoting 3 will come out in stages, with a fully functional version out, I guess, by the end of the year. But don't quote me!