articles/issue-445-plugin-custom-data-bus

related to #445 

Article needs to be added to the index.
Good point, thinking about it I'd also say that it is important that all the involved endpoints must share the same data bus and that put is called by the sending endpoint and get by the receiving one.

I'll update it, thanks.

Sent from my Amazing not anymore Yellow Lumia, typos are guaranteed ;-)
________________________________
From: Sean Feldman<mailto:notifications@github.com>
Sent: ý09/ý12/ý2014 22:39
To: Particular/docs.particular.net<mailto:docs.particular.net@noreply.github.com>
Cc: Mauro Servienti<mailto:mauro@topics.it>
Subject: Re: [docs.particular.net] articles/issue-445-plugin-custom-data-bus (#507)


In Snippets/Snippets_5/DataBus.cs<https://github.com/Particular/docs.particular.net/pull/507#discussion-diff-21564285>:

> @@ -12,4 +15,48 @@ public void Simple()
>
>          #endregion
>      }
> +}
> +
> +namespace CustomDataBusPluginSnippet
> +{
> +    #region CustomDataBus
> +
> +    class CustomDataBus : IDataBus
> +    {
> +        public Stream Get( string key )
> +        {
> +            return File.OpenRead( "blob.dat" );


This snippet could add a lot of value if demonstrates the connection between Put and Get methods. Here's an option:

    class TemporaryDirectoryCustomDataBus : IDataBus
    {
        public Stream Get( string key )
        {
            // retrieve using key provided by Put()
            return File.OpenRead(key);
        }

        public string Put( Stream stream, TimeSpan timeToBeReceived )
        {
            // the key of the stored file is full path name
            var key = Path.GetTempFileName();
            using( var destination = File.OpenWrite(key) )
            {
                stream.CopyTo( destination );
            }
            return key;
        }

        public void Start()
        {
        }
    }

Thoughts @mauroservienti<https://github.com/mauroservienti> ?

—
Reply to this email directly or view it on GitHub<https://github.com/Particular/docs.particular.net/pull/507/files#r21564285>.