Question about IServiceCapableConnection invoke

View: New views
10 Messages — Rating Filter:   Alert me  

Question about IServiceCapableConnection invoke

by Rhys Causey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm using the IServiceCapableConnection invoke method to report  
progress on a file conversion back to the flash client. The client is  
receiving the messages fine, but they all come in one large chunk  
after everything's done. I'm logging the invocations in my Red5 app,  
and they're showing up in the log at the appropriate times, but they  
only reach the client after the conversion is complete. Is there a way  
to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by rfkrocktk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It should send them at the appropriate times, but it seems that something you're doing is causing the thread to block. Try setting breakpoints and check it out.

On Wed, Jul 8, 2009 at 1:22 PM, Rhys Causey <rhys@...> wrote:
Hi,

I'm using the IServiceCapableConnection invoke method to report progress on a file conversion back to the flash client. The client is receiving the messages fine, but they all come in one large chunk after everything's done. I'm logging the invocations in my Red5 app, and they're showing up in the log at the appropriate times, but they only reach the client after the conversion is complete. Is there a way to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by Rhys Causey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmm... where could it be blocking? I also tried using a remote shared object and get the same behaviour. I set a break point in my flash client, but can't really tell anything there. It seems to make the call() and then just idle while the conversion is taking place, even though Red5 is reporting progress through the log. 

This is how I'm calling the method from my client: 
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFilename);
The client receives all of the notifications right before onSuccess is called. The order of all of the notifications is correct, it's just not receiving them at the right time.

Rhys

On 8-Jul-09, at 4:32 PM, Tyler Kocheran wrote:

It should send them at the appropriate times, but it seems that something you're doing is causing the thread to block. Try setting breakpoints and check it out.

On Wed, Jul 8, 2009 at 1:22 PM, Rhys Causey <rhys@...> wrote:
Hi,

I'm using the IServiceCapableConnection invoke method to report progress on a file conversion back to the flash client. The client is receiving the messages fine, but they all come in one large chunk after everything's done. I'm logging the invocations in my Red5 app, and they're showing up in the log at the appropriate times, but they only reach the client after the conversion is complete. Is there a way to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by rfkrocktk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try forcing the conversion to happen AFTER the service call is finished. There may be limitations in RTMP preventing calls from the server to the client from happening while calls from the client to the server are happening over one connection. Also, if your method hangs too long, Red5 will sometimes disconnect the client (after a minute or so). Try something like this and let me know what you get:

//Client
connection.client = { onProgress: onProgress };
function onProgress(percent:Number):void {
     trace(percent + "% done.");
}

// I know it's sloppy (WALTER), but it's just to see if it works :)
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFileName);

//Server
public void convertMedia(String currentFileName) {
      new Thread(new Runnable(){ public void run() { doConversion(); } }).start();
}

The point here is to make your conversion task happen asynchronously, which is definitely the best thing to do anyway :)
I would recommend using an Executor, perhaps Executors.newFixedThreadPool(16) or something of the sort. That way you can run tons of asynchronous tasks concurrently, making the best use of your machine.

On Wed, Jul 8, 2009 at 3:15 PM, Rhys Causey <rhys@...> wrote:
Hmm... where could it be blocking? I also tried using a remote shared object and get the same behaviour. I set a break point in my flash client, but can't really tell anything there. It seems to make the call() and then just idle while the conversion is taking place, even though Red5 is reporting progress through the log. 

This is how I'm calling the method from my client: 
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFilename);
The client receives all of the notifications right before onSuccess is called. The order of all of the notifications is correct, it's just not receiving them at the right time.

Rhys

On 8-Jul-09, at 4:32 PM, Tyler Kocheran wrote:

It should send them at the appropriate times, but it seems that something you're doing is causing the thread to block. Try setting breakpoints and check it out.

On Wed, Jul 8, 2009 at 1:22 PM, Rhys Causey <rhys@...> wrote:
Hi,

I'm using the IServiceCapableConnection invoke method to report progress on a file conversion back to the flash client. The client is receiving the messages fine, but they all come in one large chunk after everything's done. I'm logging the invocations in my Red5 app, and they're showing up in the log at the appropriate times, but they only reach the client after the conversion is complete. Is there a way to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org




--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by Walter Tak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Your process might be blocking Red5 from spitting out the messages to the
client. Try lowering the priority of your conversion process, either with
"nice <your command>" or renice (see man for info).

E.g. "nice -n 19 top" will run the command "top" with priority +19 (which
basically means it only runs at idle)


----- Original Message -----
From: "Rhys Causey" <rhys@...>
To: <red5@...>
Sent: Wednesday, 08 July 2009 22:22
Subject: [Red5] Question about IServiceCapableConnection invoke


> Hi,
>
> I'm using the IServiceCapableConnection invoke method to report  progress
> on a file conversion back to the flash client. The client is  receiving
> the messages fine, but they all come in one large chunk  after
> everything's done. I'm logging the invocations in my Red5 app,  and
> they're showing up in the log at the appropriate times, but they  only
> reach the client after the conversion is complete. Is there a way  to
> force it to send the messages right away?
>
> Thanks!
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org
>
>
>
> --
> Internal Virus Database is out-of-date.
> Checked by AVG. Version: 7.5.560 / Virus Database: 270.12.26/2116 -
> Release Date: 15-05-09 06:16
>


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by Rhys Causey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Tyler,

I'm trying this, but when I try to get the local connection via Red5.getConnectionLocal() in the new thread, it returns null. Also, ServiceUtils.invokeOnConnection doesn't work (presumably for the same reason). How can I access the local connection from within a new thread? 

Thanks!
Rhys

On 8-Jul-09, at 6:41 PM, Tyler Kocheran wrote:

Try forcing the conversion to happen AFTER the service call is finished. There may be limitations in RTMP preventing calls from the server to the client from happening while calls from the client to the server are happening over one connection. Also, if your method hangs too long, Red5 will sometimes disconnect the client (after a minute or so). Try something like this and let me know what you get:

//Client
connection.client = { onProgress: onProgress };
function onProgress(percent:Number):void {
     trace(percent + "% done.");
}

// I know it's sloppy (WALTER), but it's just to see if it works :)
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFileName);

//Server
public void convertMedia(String currentFileName) {
      new Thread(new Runnable(){ public void run() { doConversion(); } }).start();
}

The point here is to make your conversion task happen asynchronously, which is definitely the best thing to do anyway :)
I would recommend using an Executor, perhaps Executors.newFixedThreadPool(16) or something of the sort. That way you can run tons of asynchronous tasks concurrently, making the best use of your machine.

On Wed, Jul 8, 2009 at 3:15 PM, Rhys Causey <rhys@...> wrote:
Hmm... where could it be blocking? I also tried using a remote shared object and get the same behaviour. I set a break point in my flash client, but can't really tell anything there. It seems to make the call() and then just idle while the conversion is taking place, even though Red5 is reporting progress through the log. 

This is how I'm calling the method from my client: 
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFilename);
The client receives all of the notifications right before onSuccess is called. The order of all of the notifications is correct, it's just not receiving them at the right time.

Rhys

On 8-Jul-09, at 4:32 PM, Tyler Kocheran wrote:

It should send them at the appropriate times, but it seems that something you're doing is causing the thread to block. Try setting breakpoints and check it out.

On Wed, Jul 8, 2009 at 1:22 PM, Rhys Causey <rhys@...> wrote:
Hi,

I'm using the IServiceCapableConnection invoke method to report progress on a file conversion back to the flash client. The client is receiving the messages fine, but they all come in one large chunk after everything's done. I'm logging the invocations in my Red5 app, and they're showing up in the log at the appropriate times, but they only reach the client after the conversion is complete. Is there a way to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org




--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by Rhys Causey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm actually using a Java library to do the conversion, not running a  
process. Thanks though!

Rhys


On 9-Jul-09, at 11:09 AM, Walter Tak wrote:

> Your process might be blocking Red5 from spitting out the messages  
> to the client. Try lowering the priority of your conversion process,  
> either with "nice <your command>" or renice (see man for info).
>
> E.g. "nice -n 19 top" will run the command "top" with priority +19  
> (which basically means it only runs at idle)
>
>
> ----- Original Message ----- From: "Rhys Causey" <rhys@...>
> To: <red5@...>
> Sent: Wednesday, 08 July 2009 22:22
> Subject: [Red5] Question about IServiceCapableConnection invoke
>
>
>> Hi,
>>
>> I'm using the IServiceCapableConnection invoke method to report  
>> progress on a file conversion back to the flash client. The client  
>> is  receiving the messages fine, but they all come in one large  
>> chunk  after everything's done. I'm logging the invocations in my  
>> Red5 app,  and they're showing up in the log at the appropriate  
>> times, but they  only reach the client after the conversion is  
>> complete. Is there a way  to force it to send the messages right  
>> away?
>>
>> Thanks!
>>
>> _______________________________________________
>> Red5 mailing list
>> Red5@...
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>
>>
>>
>> --
>> Internal Virus Database is out-of-date.
>> Checked by AVG. Version: 7.5.560 / Virus Database: 270.12.26/2116 -  
>> Release Date: 15-05-09 06:16
>
>
> _______________________________________________
> Red5 mailing list
> Red5@...
> http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by rfkrocktk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Refactor your conversion task into a class, either anonymous or an actual defined class. (I'd recommend defined) Make it implement Runnable. In the constructor, take some parameters of what you need to work with in the task, ie the connection reference, file name, etc. Set those to instance variables on the class instance. Then, in your run() method, do your work, referencing the connection that way. Something like this:

// innards of serverside remoting gateway class
public class RemotingGateway {

    private Executor executor;

    public RemotingGateway() {
        this.executor = Executors.newFixedThreadPool(16);
    }

    public void doWork() {
        executor.execute(new ConversionTask(Red5.getConnectionLocal());
    }
}

//task class
public class ConversionTask implements Runnable {
   
    private IConnection connection;
   
    public ConversionTask(IConnection connection) {
        this.connection = connection;
    }

    public void run() {
        //do conversion :)
    }
}

By the way, do you understand why you can't get access to Red5.getConnectionLocal() in a new Thread? It's because Red5 does work behind the scenes to tie the local connection to the currently executing Thread, which is what you'll have to do in order to get your demo working :)

On Thu, Jul 9, 2009 at 8:44 AM, Rhys Causey <rhys@...> wrote:
I'm actually using a Java library to do the conversion, not running a process. Thanks though!

Rhys



On 9-Jul-09, at 11:09 AM, Walter Tak wrote:

Your process might be blocking Red5 from spitting out the messages to the client. Try lowering the priority of your conversion process, either with "nice <your command>" or renice (see man for info).

E.g. "nice -n 19 top" will run the command "top" with priority +19 (which basically means it only runs at idle)


----- Original Message ----- From: "Rhys Causey" <rhys@...>
To: <red5@...>
Sent: Wednesday, 08 July 2009 22:22
Subject: [Red5] Question about IServiceCapableConnection invoke


Hi,

I'm using the IServiceCapableConnection invoke method to report  progress on a file conversion back to the flash client. The client is  receiving the messages fine, but they all come in one large chunk  after everything's done. I'm logging the invocations in my Red5 app,  and they're showing up in the log at the appropriate times, but they  only reach the client after the conversion is complete. Is there a way  to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
Internal Virus Database is out-of-date.
Checked by AVG. Version: 7.5.560 / Virus Database: 270.12.26/2116 - Release Date: 15-05-09 06:16


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by Rhys Causey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I ended up just passing the connection into the new thread, and it's working! The flash client receives the progress reports right on time. Thanks a lot Tyler!

Rhys


On 9-Jul-09, at 11:43 AM, Rhys Causey wrote:

Thanks Tyler,

I'm trying this, but when I try to get the local connection via Red5.getConnectionLocal() in the new thread, it returns null. Also, ServiceUtils.invokeOnConnection doesn't work (presumably for the same reason). How can I access the local connection from within a new thread? 

Thanks!
Rhys

On 8-Jul-09, at 6:41 PM, Tyler Kocheran wrote:

Try forcing the conversion to happen AFTER the service call is finished. There may be limitations in RTMP preventing calls from the server to the client from happening while calls from the client to the server are happening over one connection. Also, if your method hangs too long, Red5 will sometimes disconnect the client (after a minute or so). Try something like this and let me know what you get:

//Client
connection.client = { onProgress: onProgress };
function onProgress(percent:Number):void {
     trace(percent + "% done.");
}

// I know it's sloppy (WALTER), but it's just to see if it works :)
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFileName);

//Server
public void convertMedia(String currentFileName) {
      new Thread(new Runnable(){ public void run() { doConversion(); } }).start();
}

The point here is to make your conversion task happen asynchronously, which is definitely the best thing to do anyway :)
I would recommend using an Executor, perhaps Executors.newFixedThreadPool(16) or something of the sort. That way you can run tons of asynchronous tasks concurrently, making the best use of your machine.

On Wed, Jul 8, 2009 at 3:15 PM, Rhys Causey <rhys@...> wrote:
Hmm... where could it be blocking? I also tried using a remote shared object and get the same behaviour. I set a break point in my flash client, but can't really tell anything there. It seems to make the call() and then just idle while the conversion is taking place, even though Red5 is reporting progress through the log. 

This is how I'm calling the method from my client: 
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFilename);
The client receives all of the notifications right before onSuccess is called. The order of all of the notifications is correct, it's just not receiving them at the right time.

Rhys

On 8-Jul-09, at 4:32 PM, Tyler Kocheran wrote:

It should send them at the appropriate times, but it seems that something you're doing is causing the thread to block. Try setting breakpoints and check it out.

On Wed, Jul 8, 2009 at 1:22 PM, Rhys Causey <rhys@...> wrote:
Hi,

I'm using the IServiceCapableConnection invoke method to report progress on a file conversion back to the flash client. The client is receiving the messages fine, but they all come in one large chunk after everything's done. I'm logging the invocations in my Red5 app, and they're showing up in the log at the appropriate times, but they only reach the client after the conversion is complete. Is there a way to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org




--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

Re: Question about IServiceCapableConnection invoke

by rfkrocktk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey no problem, just make sure you're using an Executor to execute your tasks, and you should be fine :)

On Thu, Jul 9, 2009 at 9:51 AM, Rhys Causey <rhys@...> wrote:
I ended up just passing the connection into the new thread, and it's working! The flash client receives the progress reports right on time. Thanks a lot Tyler!

Rhys


On 9-Jul-09, at 11:43 AM, Rhys Causey wrote:

Thanks Tyler,

I'm trying this, but when I try to get the local connection via Red5.getConnectionLocal() in the new thread, it returns null. Also, ServiceUtils.invokeOnConnection doesn't work (presumably for the same reason). How can I access the local connection from within a new thread? 

Thanks!
Rhys

On 8-Jul-09, at 6:41 PM, Tyler Kocheran wrote:

Try forcing the conversion to happen AFTER the service call is finished. There may be limitations in RTMP preventing calls from the server to the client from happening while calls from the client to the server are happening over one connection. Also, if your method hangs too long, Red5 will sometimes disconnect the client (after a minute or so). Try something like this and let me know what you get:

//Client
connection.client = { onProgress: onProgress };
function onProgress(percent:Number):void {
     trace(percent + "% done.");
}

// I know it's sloppy (WALTER), but it's just to see if it works :)
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFileName);

//Server
public void convertMedia(String currentFileName) {
      new Thread(new Runnable(){ public void run() { doConversion(); } }).start();
}

The point here is to make your conversion task happen asynchronously, which is definitely the best thing to do anyway :)
I would recommend using an Executor, perhaps Executors.newFixedThreadPool(16) or something of the sort. That way you can run tons of asynchronous tasks concurrently, making the best use of your machine.

On Wed, Jul 8, 2009 at 3:15 PM, Rhys Causey <rhys@...> wrote:
Hmm... where could it be blocking? I also tried using a remote shared object and get the same behaviour. I set a break point in my flash client, but can't really tell anything there. It seems to make the call() and then just idle while the conversion is taking place, even though Red5 is reporting progress through the log. 

This is how I'm calling the method from my client: 
connection.call("convertMedia", new Responder(onSuccess, onFault), currentFilename);
The client receives all of the notifications right before onSuccess is called. The order of all of the notifications is correct, it's just not receiving them at the right time.

Rhys

On 8-Jul-09, at 4:32 PM, Tyler Kocheran wrote:

It should send them at the appropriate times, but it seems that something you're doing is causing the thread to block. Try setting breakpoints and check it out.

On Wed, Jul 8, 2009 at 1:22 PM, Rhys Causey <rhys@...> wrote:
Hi,

I'm using the IServiceCapableConnection invoke method to report progress on a file conversion back to the flash client. The client is receiving the messages fine, but they all come in one large chunk after everything's done. I'm logging the invocations in my Red5 app, and they're showing up in the log at the appropriate times, but they only reach the client after the conversion is complete. Is there a way to force it to send the messages right away?

Thanks!

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org




--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org



_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org




--
And do this, knowing the time, that now it is high time to awake out of sleep;
for now our salvation is nearer than when we first believed.

_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org