Tags: , | Categories: Software Development Posted by bjarte.skogoy on 5/7/2010 8:11 AM | Comments (0)

I’ve been using Rhino Service Bus in some projects and needed a way to bridge it with synchronous WCF calls. Here’s the code:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rhino.ServiceBus.Sagas;
using Rhino.ServiceBus;
using System.Threading;
using Rhino.ServiceBus.Internal;

namespace Rhino.ServiceBus
{
    public static class ReplyExtension
    {
        class ESBResult<R> : OccasionalConsumerOf<R>, IDisposable
        {
            ManualResetEvent waithandle;
            IServiceBus bus;
            IDisposable subscription;
            TimeSpan patience;

            public ESBResult(IServiceBus bus, ISagaMessage message, TimeSpan patience)
            {
                this.bus = bus;

                this.patience = patience;
                waithandle = new ManualResetEvent(false);
                subscription = bus.AddInstanceSubscription(this);
                bus.Send(message);
            }

            public ESBResult(IServiceBus bus, ISagaMessage message)
                : this(bus, message, TimeSpan.FromSeconds(5))
            {
            }

            public R Reply
            {
                get
                {
                    waithandle.WaitOne(patience);
                    return m_Reply;
                }
            }

            #region ConsumerOf<R> Members

            R m_Reply = default(R);
            public void Consume(R message)
            {
                m_Reply = message;
                waithandle.Set();
            }

            #endregion

            #region IDisposable Members

            public void Dispose()
            {
                var b = bus;
                subscription.Dispose();
            }

            #endregion
        }

        public static R SendAndWaitForReply<R>(this IServiceBus bus, ISagaMessage message)
        {
            using (var result = new ESBResult<R>(bus, message))
                return result.Reply;
        }
    }
}

Posted by bjarte.skogoy on 8/11/2009 10:50 PM | Comments (12)

The performance index isn’t bad at all.

image

Posted by bjarte.skogoy on 8/8/2009 12:41 AM | Comments (11)

I think a screenshot is in place.

windows7

Posted by bjarte.skogoy on 5/20/2009 8:52 PM | Comments (1)

IMAG0070

Han kan vær travel, men vett i alle fall koss en skikkelige middagskvil ska vær.

Posted by bjarte.skogoy on 4/7/2009 11:34 PM | Comments (6)
91 Ord

Speedtest

Posted by bjarte.skogoy on 4/7/2009 11:32 PM | Comments (0)
87 Ord

Speed test

Tags: , , , | Categories: .Net, Software Development Posted by bjarte.skogoy on 2/28/2009 8:48 PM | Comments (0)

I felt the need to contribute somewhere in the open source department. My first move was to start a provider for Euss enabling support for using SimpleDB as storage. Store your objects in the cloud! It’s buggy and the query language is only partially implemented. But anyway. It does work.

It has the immensely creative name “SimpleDB for Euss”. You can find the source and upcoming releases on codeplex.

Posted by bjarte.skogoy on 1/3/2009 8:33 AM | Comments (0)

Det uunngåelige skjedde igjen. Et nytt år har kommet. Bilder fra forberedelsene kan du se hos Frøken Aadalen

Tags: | Categories: Software Development Posted by bjarte.skogoy on 11/8/2008 5:48 AM | Comments (2)

Long time no blog. Amazon recently announced Windows support in EC2. I had to check it out. The pricing isn't bad and the largest instance types really does the job.

4 cores 3 GHz each and 15 GB of RAM isn't the everyday workstation:
taskmanager properties

Posted by bjarte.skogoy on 9/6/2008 8:13 AM | Comments (6)

My HP 8510w has got it self a new disk. Not any disk!
The new WD Scorpio Black Edition 320GB, 7200RPM, 16MB Cache.
It's blazingly fast and my Vista experience index now looks like this:

vistaindex

The labels are in Norwegian. My hdd has an experience index of 5.8, on a laptop. I'm happy for now.