« Return to Thread: NotImplementedException during RouteMessage

Re: NotImplementedException during RouteMessage

by Support-179 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View in Thread


I wrote in one of my previous emails where to get v1.0.0.17 before it is released (http://code.google.com/p/fluorinefx/)

The player actually opens two tcp connections then closes one (you will get a second very short lived client)

You have more then one solution to accomplish what you want:

1) listening with IClientListener, for example

class TestAdapter : MessagingAdapter, IClientListener{

static TestAdapter(){
        Client.AddClientCreatedListener(this);
}

public void ClientCreated(IClient client)
{
   //A new client instance was created
   client.RemoveClientCreatedListener(this);
   client.AddClientDestroyedListener(this);
    ...
}

public void ClientDestroyed(IClient client)
{
    //A client instance was destroyed
    client.RemoveClientDestroyedListener(this);
    ...
}

2) Override a messaging adapter's Manage method and start listening for new clients

class TestAdapter : MessagingAdapter, IClientListener{

public void ClientCreated(IClient client)
{
        //NOP
}

public void ClientDestroyed(IClient client)
{
    //A client instance was destroyed
    client.RemoveClientDestroyedListener(this);
    ...
}

public override bool HandlesSubscriptions{ get { return true; } }

public override object Manage(CommandMessage commandMessage)
{
        IClient client = FluorineContext.Current.Client;
        //Even if the same client instance is received many times here the listener interface is added only once internally
        client.AddClientDestroyedListener(this);
        return base.Manage(commandMessage);
}

In the second case you would begin to listen for IClient destroyed event (delayed) only when consumers start using the channel.


-----Original Message-----
From: fluorine-bounces@... [fluorine-bounces@...] On Behalf Of Martin Wickman
Sent: Tuesday, April 21, 2009 10:20 AM
To: Fluorine Mailing List
Subject: Re: [Fluorine] NotImplementedException during RouteMessage

Thanks,

So the solution would be to get a newer version (I'm running v1.0.0.15). Hmm... when is a the new release due? I could not find anything fresher than v1.0.0.15 on the FluorineFx site.

Regarding this, it seems that my SessionCreated()/SessionDestroyed() is called three times for a single client. Is that one time for each RemoteObject/Consumer/Producer the client is using? It seems to match at least.

Anyway, what I really want is to be notified when a client (that is, the FlexClient/swf-file) is timed out, most probably due to user closing the browser. You mention something about listening for IClient and IMessageClient destroyed events. I could not find anything in the code about that. Could you guys give me a pointer here, if possible?

/Thanks!

-----Original Message-----
From: fluorine-bounces@... [fluorine-bounces@...] On Behalf Of Support
Sent: den 21 april 2009 00:14
To: 'Fluorine Mailing List'
Subject: Re: [Fluorine] NotImplementedException during RouteMessage

Hi Martin,

In the old version you can delete the exception from _TimeoutContext (it should work as long the destination you are using to push does not define security constraints)

"The reason is obvious: you cannot send a message to a client that has timed out" -> Actually you are not doing that. You are broadcasting (pushing) a message back to the clients and even if the current client is disconnecting you must be able to do that (so the exception is a bug)

In the new version this was moved out from the context classes.
However if you have -secured- destinations a security error may still happen depending which object's time out are you listening for:
- in the case of IClient destroyed event you would need per client authentication configured (so when the client times out FluorineFx can restore the correct security context)
- in the case of ISession destroyed event you would need per session authentication configured (so when the session times out FluorineFx can restore the correct security context)
- in the case of IMessageClient destroyed event both configurations should work (you possibly do not need to listen for MessageClient events) This is because when the time out happens on a server thread that thread does not have configured any security context (it was started by the ASP.NET runtime without any client request) Then your code routes a new message through the Message Broker, and the broker will try to perform security checks (if applicable)

Zoli

-----Original Message-----
From: fluorine-bounces@...
[fluorine-bounces@...] On Behalf Of Martin Wickman
Sent: Sunday, April 19, 2009 5:27 PM
To: fluorine@...
Subject: [Fluorine] NotImplementedException during RouteMessage

Hello

When a client disconnects from the server, that is, when the client closes the browser/tab and the time out eventually occurs, I wanted to broadcast that event to all other clients telling them that this client is not longer there. I implemented this as listening on SessionCreated/SessionDestroyed events. It seemed as straightforward as doing this in the SessionDestroyed
handler:

        // In my service constructor:
                ClientManager.AddSessionCreatedListener(this);

        // In my listener class:
        public void SessionCreated(IClient client)
        {
                client.AddSessionDestroyedListener(this);
        }
    
        public void SessionDestroyed(IClient client)
      {
                broadcastStatus(); // Throws exception!
                client.RemoveSessionDestroyedListener(this);
        }

The broadcastStatus() method sends an AsyncMessage to the destination as usual. But the problem is that I get a NotImplementedException from the FluorineFx.Context._TimeoutContext when I call messageBroker.RouteMessage.
See stack trace below. The reason is obvious: you cannot send a message to a client that has timed out.

So how can I get around this, i.e. how can I send a message to the other clients that still are connected?

This seems like it could be a race condition and could possibly occur if unlucky.

NotImplementedException "The method or operation is not implemented."
   at FluorineFx.Context._TimeoutContext.RestorePrincipal(ILoginCommand
loginCommand)
   at FluorineFx.Messaging.MessageBroker.RouteMessage(IMessage message, IEndpoint endpoint)
   at FluorineFx.Messaging.MessageBroker.RouteMessage(IMessage message)
   at ServiceLibrary.TreeLock.broadcastLockingStatus() in ...
   at ServiceLibrary.TreeService.SessionDestroyed(IClient client) in ...
   at FluorineFx.Messaging.Client.Disconnect(Boolean timeout)
   at FluorineFx.Messaging.Client.Timeout()
   at FluorineFx.Messaging.ClientManager.RemovedCallback(String key, Object value, CacheItemRemovedReason callbackReason)

/Cheers
Martin

_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesil
entgroup.com


_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com



_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

 « Return to Thread: NotImplementedException during RouteMessage