Menu

Concept of AsyncWcfLib

asy proger
  • AsyncWcfLib is built above Microsoft Windows Communucation Foundation (WCF).
    It creates a higher level of abstraction.

  • It focuses on asynchronous communication.
    Synchronous (blocking / waiting) calls are not provided.
    Since Version 3.0 it supports C# async-await semantics.

  • The same API supports threadsafe message passing between actors inside an application process.
    Actors are a collection of objects running on - and bound to - one single thread (like e.g. WinForms- or WPF controls).
    AsyncWcfLib - Actors create their own input and output 'ports'.
    An independent entity may link output to input ports thereby defining whether the link is through an application internal message queue
    or through a network to a remote application.
    AsyncWcfLib supports application internal message queues using Thread.SynchronizationContext.
    Proxys and stubs for remote WCF connections are automatically established.

  • The library user focuses on Messages and DataContracts.
    This is done by classes derived from interface 'IWcfMessage', see [AsyncWcfLib class diagram messages].
    Sending and receiving of messages is not a hidden operation behind method calls.
    This is important because different rules apply for messaging compared to normal method calls.
    Messages are the vehicle to support threadsafety and version tolerance:

    1. Message member objects must never being touched after sending by any actor except the receiving one.
      Or the message members must be immutable. So there will be no danger when several actors read from the same message on different threads.

    2. Applications sending messages to a remote actor may be of newer or older version than applications receiving messages.
      See [AsyncWcfLib package diagram].
      Messages of newer version may contain more or less member objects than the older version.
      Older applications may not know messages sent from newer applications.
      A careful message design makes it possible to support backward and forward version compatibility.
      This is very important because normally not all interacting applications can be updatet at exactly the same time.
      Think for example subversion would force you to update all clients and servers at the same time.
      And then consider a user having working-copies of several svn-servers!

  • AsyncWcfLib uses only the client-server communication model.
    Other models like 'publish-subscribe' or 'duplex-channel' may be easily built using programmatically generated ActorOutput or ActorInput objects.
    Linking of such objects is the same as other actor ports: Give each port a name and call a link method.
    AsyncWcfLib automatically handles proxy/stub creation and host/port discovery.
    Having an ActorOutput and ActorInput for each partner of a 'publish-subscribe' relationship enables you to check each connection
    and reliably transfer all data.


Related

Wiki: Async-Await and Actor rules!
Wiki: AsyncWcfLib class diagram messages
Wiki: AsyncWcfLib package diagram
Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.