Author Support

Oct 19, 2011 at 12:36 AM

Who can I contact for support on the Bayeux assembly? I am receiving a "System.InvalidOperationException : Another request is being processed. Call Cancel() method first" when I invoke the PublishSync() method on the BayeuxConnection instance.

Oct 20, 2011 at 10:17 AM

Hi,

You can contact with me ;)
So as the exception message says - are you sure that you didn't call any other async request, which is not yet completed?
Can you publish some code-snippet?

Cheers,
 Pawel

Oct 20, 2011 at 4:46 PM

Basically I wrapped your BayeuxConnection class in a wrapper class that maintains a static reference to the BayeuxConnection class. Clients that uses the wrapper invokes, the Connect, Publish, and Disconnect methods.

using CodeTitans.Bayeux;
using CodeTitans.JSon;

namespace MyNameSpace
{
    public class BayeuxConnectionWrapper
    {
        private static BayeuxConnection s_connection = new BayeuxConnection(aHardCodedUrl);

        public static void Connect()
        {
            if (s_connection.State == BayeuxConnectionState.Disconnected)
            {
                s_connection.HandshakeSync();
                s_connection.ConnectSync();
            }
        }

        public static void Publish(string channel, IJSonWritable jsonWritableObject)
        {
                try
                {
                    s_connection.PublishSync(channel, jsonWritableObject);
                }
                catch (Exception)
                {
                        s_connection.Cancel();
                        s_connection.PublishSync(channel, jsonWritableObject);
                }
        }

        public static void Disconnect()
        {
            if (s_connection.State != BayeuxConnectionState.Disconnected)
            {
                s_connection.DisconnectSync();
                s_connection.Dispose();
            }
        }
    }
}

Oct 20, 2011 at 4:49 PM

Notice that I am not calling any Async methods. I am only using Sync methods. By the way where are you located? In the U.S.? We may need some paid on-site support.

Oct 21, 2011 at 12:06 AM

Hi,

I am currently settled in Poland (EU), so I can provide you some online support.

To be honest, I used Bayeux in two projects, but mostly the asynchronous version and I haven't seen any problems with them. I used synchronous only for unit-testing. 

Anyway, I will try to give a go to your sample wrapper and check if there are some issues with the BayeuxConnection class itself.

 

Cheers,
 Pawel 

Oct 21, 2011 at 12:10 AM

One more thing... take a look on CodeTitans.UnitTests project, file 'CometDTests.cs' and find ignored test 'ConnectToServer()'. It was working fine not so long time ago. Please try to compare the way you call the BayeuxConnection API with this sample.

Oct 21, 2011 at 7:15 PM

Thanks,

I will take a look at that unit test project. I have two more questions.

1) Do you have time and are you willing to give me a walkthrough of your Bayeux assembly over a webex meeting? If needed I can pay for your time. (Just let me know what the rate would be up font.

2) Do you need help to write up some documentation and sample code for this assembly?

Regards,

Fritz


From: "FeydRauth" <notifications@codeplex.com>
To: fritzfrancis@comcast.net
Sent: Thursday, October 20, 2011 7:10:38 PM
Subject: Re: Author Support [codetitans:276369]

From: FeydRauth

One more thing... take a look on CodeTitans.UnitTests project, file 'CometDTests.cs' and find ignored test 'ConnectToServer()'. It was working fine not so long time ago. Please try to compare the way you call the BayeuxConnection API with this sample.

Oct 24, 2011 at 10:59 AM

Hi,

I am just curious, what kind of help you like to receive.
Bayeux is just an "envelope" for your real protocol. What you actually need is:
 - to define that protocol and implement it on client side
 - implement a server-side that is able to generete proper client IDs (and keeps repository of them as it should also work when client disconnets for some time) and listen for specific channels to execute some actions. This doesn't need to be in .NET at all ;)

"Channel", "data" and "ext" fields of the bayeux message are something that you use to build your own protocol. You must define what other JSON objects/fields are required while accessing given channels, and what those channels are actively doing on the server side.
If you look closer on the unit-test I mentioned, and Bayeux documentation the samples exposed on http://cometd.org/documentation/bayeux, you will understand what I mean by that. That's why I didn't focus on my own, as lots of materials is already there...

To do it effectively using Bayeux@CodeTitans, you must just combine few things and then it's pretty easy to continue, add new actions etc. The BayeuxConnection class you've already found. Then there are some others like:
 * BayeuxRequest - subclass it to send your own requests to server (are receive / parse responses)
 * BayeuxResponse - the data that came from server
 * ITaskExecutor (and its subclasses) - to move Bayeux handling to another thread and also schedule a number of requests to execute (but one at once)
 * IHttpDataSource (and its subclasses) - as an abstraction, where to send data; it doesn't force you to use HTTP, you might also communicate with some local services using raw sockets or named-pipes - I did it with success!

What I really suggest is - focus on asynchronous calls. Due to the fact that primary communication target is based on HTTP and network connectivity, it's always more efficient and more reliable. I would suggest sync calls only for testing at the beginning of your project.

If you have then more detailed questions, please let me know as a private message.

Cheers,
 Pawel

 

Nov 8, 2011 at 9:12 PM

Thanks Pawel.