using System; using System.Collections.Generic; using System.Text; using System.IO; using BCG.Utilities.General; namespace BCG { /// /// This is the interface that both the PublisherCore and the /// SubscriberCore use to communicate with the PubsubServer. /// This manages the exchange of information to one /// pubsub server. /// Based on the URL, its constructed by the /// PubsubServerConnectionFactory. All PubCores share /// common IPubsubServerConnection for each URL, while /// every instance of the SubscriberCore guarantees a new /// connection to the Pubsub. /// Its supposed to be used from a single thread. If /// multiple threads need to communicate to the PubSub, they /// should create their own Subscribers. /// public interface IPubSubServerConnection : IDisposable, IWorker { /// /// The delegate is fired signalling if the data send was /// successful or not /// //void sendWithConfirmation(byte[] data, ref string confId); /// /// send is a non waiting call with no guarantee /// of data being delivered /// // void send(byte[] data); // /// // /// similiar to above // /// //void send(Stream str); //void send(PubSubMessage msg); void send(bts.PubSubClientMessage ps_msg); //void send_with_confirmation(PubSubMessage msg, ref string confId); /// /// Returns with 0 or more elements, iff the timeout /// expires or maxElements have been reached (selective polling), /// whatever comes first. /// For example, a timeout of TimeSpan.max and maxElements of 1, /// would wait until it gets the first element and returns /// with it. /// A timeout of 0 and maxElements /// of Int32.Max would return all the messages it has /// received between last getUpdates and this call. /// get_updates(TimeSpan timeout, int maxElements); /// /// server URL to which the connection is made /// string server_url { get; } /// /// client URL as seen by the server. if a connection has not /// been established (as can happen in TCP) an empty string /// is returned /// string client_url { get; } /// /// registers the callback to receive /// connection notifications /// void register_connection_callback(PubSubServerConnectionStatusChange del); /// /// registers callbacks to reveive data /// /// void register_data_callback(PubSubServerDataDelegate del); //void register_send_confirmation_callback(SendConfirmationDelegate del); } }