I really like travelling because I can spend more time coding. So, last week while travelling in Germany and Italy for work, I found some time to finish the WS-Eventing implementation to which I referred in previous posts (post1, post2). I am guessing that there are going to be interoperability problems with existing implementations because I chose to use the current version of WS-Addressing (March 2004) rather the one that the current WS-Eventing specification uses (March 2003).
I have made the assembly with both the source and sink implementations available (http://wsgaf.ncl.ac.uk/services/eventing/wse.dll) if anyone wishes to use it (no documentation yet apart from blog posts… perhaps will work on the documentation later). I guess it’s going to be more interesting testing interoperability with other implementations rather than downloading and using my assembly.
I have deployed a simple eventing service at http://wsgaf.ncl.ac.uk/services/eventing/eventing.ashx. You can use this endpoint as per the WS-Eventing specification minus two things for the moment: XPath support for the subscription filter and SOAP faults. When you subscribe your event sink with this service, you’ll receive a notification message every 5 seconds with the time here in Newcastle. Yes, I know… not the most useful information out there 🙂
Here’s the code for the simple program that raises this event (minus the “using” directives):
class
Program
{
static
void Main(string[] args)
{
Timer
timer = newTimer(int.Parse(args[0]));
timer.Elapsed += newElapsedEventHandler(timerElapsed);
timer.Enabled = true;
Console
.WriteLine(“Press ENTER to exit.”);
Console
.ReadLine();
}
static
void timerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
EventingSource
.RaiseEvent(newTimeInNewcastle(), newUri(“uk:ac:neresc:newcastletime:time”));
}
}
[XmlRoot(Namespace = “uk:ac:neresc:newcastletime”)]
public
class
TimeInNewcastle
{
public
DateTime
Time = DateTime.Now;
}
}
The EventingSource.RaiseEvent will do the trick.
A simple sink client that will start receiving events and then will send an “unregister” message follows:
class
Program
{
[STAThread]
static
void Main(string[] args)
{
Uri
sinkUri = newUri(“soap.tcp://localhost:10001/sink”);
Uri
serviceUri = newUri(“soap.tcp://localhost:10002/service”);
SoapReceivers
.Add(newEndpointReference(sinkUri), typeof(SinkSoapService));
SoapReceivers
.Add(newEndpointReference(serviceUri), typeof(MySoapReceiver));
Subscription
subscription = newSubscription(newUri(“http://wsgaf.ncl.ac.uk/services/eventing/eventing.ashx”));
subscription.EndTo = new uk.ac.neresc.eventing.messages.Epr(sinkUri);
subscription.NotifyTo = new uk.ac.neresc.eventing.messages.Epr(serviceUri);
subscription.Lease.Duration = newTimeSpan(0, 0, 10);
// You can even add Refernece Properties if you want here
EventingSource
.Register(subscription);
Console
.WriteLine(“Waiting for ENTER”);
Console
.ReadLine();
EventingSource
.UnRegister(subscription);
Console
.WriteLine(“Waiting for ENTER”);
Console
.ReadLine();
}
class
MySoapReceiver
: SoapReceiver
{
public
MySoapReceiver
()
{
}
protected
override
void Receive(SoapEnvelope envelope)
{
Console
.WriteLine(“Event received…”);
envelope.Body.WriteTo(new System.Xml.XmlTextWriter(Console.Out));
}
}
}
Please feel free to send me comments/questions/complaints/requests etc.
There’s a unique energy that comes with starting something new — a blend of excitement,…
As I continued work on BrainExpanded and its MCP service, I came to realize that…
Just over a month ago, I published "Playing with graphs and Neo4j". Back then, it…
After my initial implementation of some BrainExpanded-related ideas on top of dgraph using its GraphQL…
Say hello to the Graph Model Domain Specific Language (GMDSL), created with the help of…
As I wrote in previous posts, the manual recording of memories for BrainExpanded is just…