Cross-platform open-source asychronous HTTP and DB with C# - c#

Does anyone know of a good resource for open-source libraries for asynchronous C# (or native stuff to the language). I'm interested in anything on this topic, but I'm specifically looking for stuff pertaining to HTTP and DB calls. Maybe an event-driven framework with plugs for HTTP and DB?
Unfortunately I can't use a non-C# solution or anything that does not work on mono, unless it is planned to run on mono soon.

For HTTP, it kinda depends on whether you're talking about client or server. Assuming client, you could just use the *Async methods in WebClient
http://www.go-mono.com/docs/index.aspx?link=T:System.Net.WebClient/*
For DB, the sqlcommand (or similar) class exposes BeginExecute* methods for async calls
http://www.go-mono.com/docs/index.aspx?link=T:System.Data.SqlClient.SqlCommand/*

You would probably have to use some kind of queue system. There are lots of queue engines. MSMQueue is the "standard" Microsoft solution.

Have you looked at the Linxter Internet Service Bus system? You can find some details at http://www.linxter.com and some sample apps that show how to perform database transactions distributed over the Internet.

The question is quite generic, both HTTP, DB and asynchronous could mean a lot of different things, depending on the requirements:
On codeplex you can find a more standards compliant HTTP server implementation which is event driven, compatible with Mono and has been used by others successfully.
There are a number of Asp.Net providers, as well as NHibernate
For Linq to Sql, your best option will probably be to use DbLinq although DbLinq is being included in the Mono namespace.

You probably should check NServiceBus. If it runs on mono it offers you a good framework for asynchronous calls (based on messaging).
It doesn't offer DB or HTTP connectivity by default, but this should be fairly easy to integrate.

Related

What are the different between Super Web Socket and Nugget?

I have implemented my application in C# with use of Supper Web Socket the.NET implementation of WebSocket server. I have heard about the Nugget which is another .NET Web Socket server. What are the key differences? I have been to the website 'nugget.codeplex.com' but could not find useful info. I would like to know from someone who had experience with Nugget.
http://nugget.codeplex.com/documentation
Websocket server: onopen function on the web socket is never called
http://www.undisciplinedbytes.com/2010/06/html-5-c-web-sockets-server-and-asp-net-client-implementation/
http://jxs.me/2011/05/28/csharp-websockets-with-fleck/
A simple Google search came up with this. Please understand that there is a vast multitude of services and libraries in existence and the best way is not to demand expertise but to call on someone who might have some, if any knowledge. Try to implement both along side each other yourself and see the differences based on the documentation. My guess will be that there is very little difference except for how the code is wrapped or the algorithmic approached. Both, if they do the same thing, should do what you want them to fairly well. Its Apples and Oranges.

Asynchronous message passing in .NET

I am looking for a simple .NET library that implements a concept of async message passing similar to Erlang OTP platform. So far, I have only found RetLang to be somewhat similar, but
It seems to be abandoned, and
It only supports message passing within one process.
You can try with MSMQ .you can use for single or a group of messages you want to put in the queue and read from it later asynchronously. :)
In my opinion the easiest way to do this in .net (aside from F# ;) ) is the TPL dataflow - lib
Use MSMQ which is quite simple to implement. It is exactly what you need - asynchronous messaging system. WCF is also good but is more complex to manage (config files) and adds a bit of overhead. MSMQ is a standard (and free) Windows component but to use it you need to enable it. MSMQ can be used for local communication (same process or any 2 processes within the same Windows domain)
Read this answer for more details and code examples.
Microsoft research developed and proved out (with EA/Bioware) a project called Orleans. It has been used in production and is being actively developed.
Quick Summary
Intro on Pluralsight
https://github.com/dotnet/orleans
You can use WCF to send and receive asynchronous messages. you can read more at msdn
Please have a look at spring messaging, this might be useful for you.

Distributed Programming Technology

I'm looking for a technology which is targeting on building distributed applications. My friend adviced me to use CORBA (Java & C++ combination) . But I have read it's sort of obsolete stuff. I'm planning to write rather simple distributed application. What solutions would you advice to use? Thanks!
If you want to distribute your code logic to multiple servers and have it managed as a single entity, I would recommend CloudIQ Platform from Appistry. You can deploy Java, .NET and C/C++ code to the framework. From an administrative point of view, the servers work and act as one. When you submit a request for execution, the framework distributes the request to the best available worker, performing load balancing. With this framework, you can have producer/consumer, scatter/gather, and other parallel types of jobs.
The framework also monitors the execution of jobs, so if there is any type of hardware failure, other machines will get allocated the jobs that were running on the failed server.
CORBA is quite old. To choose a library or framework, the questions are: why do you want it to be distributed? (what's the goal? performance / parallelization? scalability? physical constraints on locations of parts of the system?) Which sort of nodes will be running the various parts? What languages would you rather use?
Recommend using ICE(Internet Communications Engine), ICE can support multiple operating system platform (Windows, Linux, Solars, Mac OS, iOS, Android...), multiple developing language (C++, Java, .NET, Python, Ruby, PHP), and it is simpler.
You can use SOAP web services. I'm currently developing distributed testing system on Python & .NET using using SOAP and it is easy to write and deploy.
There are a lot of different SOAP server/client libraries for different languages and platforms.
Yes, CORBA, and technologies like COM and DCOM are all pretty much obsolete... I am not sure exactly what you want to accomplish, but I would look towards .NET remoting to build distributed applications. If your application is really simple, you can even use mailslots or named pipes to pass simple data across a network.
As sinelaw mentioned, there are many questions before a good suggestion can be made, but, you may want to look at REST (http://en.wikipedia.org/wiki/Representational_State_Transfer) as a way to transfer data between applications. REST is nice in that what it can accept and return are flexible, for example, you can upload a file and return a PDF. Though it is used on http, that isn't the only allowed protocol. It is language/platform agnostic.
If you want to go with something that is standardized then SOAP or REST is probably your best bet, if you want to be platform-independent. If you don't mind being restricted to Java/JVM or .NET then there are other options, but that becomes very restricting.
What type of data is being passed? How critical is security? What platforms/languages should be usable? What is the purpose of the program, the goal?
If you want a portable solution that can also be used with different protocols, WCF on Mono might be a good fit
For .Net I suggest you WCF , it's quite simple to implement and very flexible, and about CORBA it's a good choice if your goal is to understand deeply distributed applications, but it's not more recommended for real projects, currently is very difficult to find developers mastering CORBA.

Custom SQL Server driver

I had a crazy thought about writing my own SQL Server driver to make it work something like non-blocking http client, so it won't be thread thirsty and could handle lots of db queries within one thread.
I tried to look over google for some guidelines about implementing SQL Server client protocol, but found none really, where do those guys get information about it when they write own implementations for PHP or python?
I need a really low level to be documented so I can implement all phases of working with a connection through sockets. And would be really nice to have a an example in c# language. :)
I regularly use the existing Async functionality in the .NET SQLClient, this easily allows additional threads to handle the database operations.
I'm not sure how you would really handle multiple non-blocking operations in the same thread.
MSSQL Protocol specs:
http://www.microsoft.com/downloads/details.aspx?familyid=91ef5106-944a-41e1-b3a0-5bd3f2356f32&displaylang=en
Without knowing anything factual about it, I would guess that PHP et al, use either the native MSSQL API or they use the standardized ODBC - warping around at the protocol level is just asking for it.

C# Queue or ServiceBus with no dependencies?

Is there a product (ideally open source, but not necessary), that would enable a zero dependency deployment? every service bus or queue library I've been able to find has a dependency on one of the queue apps (like msmq), or a database. I would like a very lightweight solution that I can just add a reference to my application, build it, and deploy it with as little configuration as possible.
In an ideal world, the queue/service bus would run on IIS, and allow web and rich clients to talk to it.
Such a tool would be ideal for fast prototyping of large distributed systems on a local development machine.
Rhino Queues from Ayende is exactly what you are looking for, this is the blog post introducing it:
http://ayende.com/Blog/archive/2008/08/01/Rhino-Queues.aspx
I think that all of the limitations mentioned in this post have been fixed since then.
From the blog post, what rhino queues is:
XCopyable, Zero Administration, Embedded, Async queuing service
Robust in the face of networking outages
System.Transactions support
Fast
Works over HTTP
In a similar vein to ShuggyCoUk's suggestion, you could rig up a queue (or queues) using the Windows built-in ESENT database (comes already installed with Windows). There is a managed code access library (open source): http://www.codeplex.com/ManagedEsent. If you stick with writing / reading CLOBs or BLOBs, it should work just fine. If you want to be really clever, you can use NServiceBus and write (contribute?) ESENT-flavored subscription storage and transports. There are some forays into using ESENT on Ayende's blog as well (you'll have to poke around his SVN repository for the juicy bits).
If you're happy to be:
Windows specific
Limited to the local domain
Seriously limited in the message size supported
Wrap the underlying win32 calls in P/Invoke
Deal with the polling yourself
Deal with the hacks needed to allow back and forth communication
Deal with the shared config needed to keep the names in sync
Then a quick wrapper around the windows MailSlot API might be sufficient.
This simple example is a reasonable basis to start.
This article has some further information but assumes the use case is via a control (rather than a Component as it should be) as well as some poor WinForms integration so should be considered for incidental reading rather than a basis for any library.
This article is C++ but is of a higher standard (and a commenter has extended it to support the batching of larger messages into several smaller ones).
You get 424 bytes (so with .Net 212 chars) you may want to drop to ASCII to double your useful message length if you are talking text.
Note that despite its simplicity, limitations and lack of features it does provide multicast delivery, something often complex to layer on a point to point protocol yourself.
This ayende post provides and interesting comparison of three service buses. We use NServiceBus and think if it's not clear that Udi Dahan would respond to how you'd plug in non-dependent queue.
We work using MSMQ happily but there are other options and in theory it should be open to practically anything, given that you may lose some reliability and durability depending on your choice.
Why not Amazon's message service Simple Queue Service?
We moved our projects from MSMQ to ActiveMQ. its really better :)
ActiveMQ is open source queue ,based on Apache web server.
We used him in production on high frequently data workflow, where msmq have a lot of problem (we work with msmq a year)
The csharp implementation is nms
I'm currently working on an open source WCF based service bus. You can find it here: http://rockbus.codeplex.com/. It supports dynamic (#run-time) subscriptions, subcription repository (database), pluggable transports, XPath based content-based routing, transactional delivery over wcf protocols, roundrobin delivery, pluggable subscription evaluation, and more. Have a look!
Have you thought about using a service like IronMQ by http://Iron.io?
You wouldn't have any dependencies, could quickly prototype apps without setting up any queue infrastructure, and it's highly available and fast.
There is not currently a locally installable version but it's based on the upcoming OpenStack protocol so there will be.
Btw I work for Iron.
Try https://github.com/mcintyre321/PieQ - this is my attempt to write a threadsafe, persistent, zero-config, embedded work queue. It probably needs a little love, but I think it might be the kind of tool you are looking for.
I have developed an InMemory JMS library which can be used to in testing JMS applications without really connecting to JMS providers/server (Think of hsqldb). You don't have to deal with connection or protocol or anything, all you need to do is to send and receive messages.
https://github.com/Dhana-Krishnasamy/InMemoryJMS

Categories