Exemple #1
0
        public void FromSimpleQueueName()
        {
            var name = QueueName.FromSimpleQueueName("Ali");

            Assert.True(name.IsSimpleQueue);
            Assert.False(name.IsTopic);
        }
        public void CanCreateSendAndReadFromSimpleQueue()
        {
            string q         = "shabash";
            string content   = "shaki";
            var    queueName = QueueName.FromSimpleQueueName(q);
            var    operat    = new RabbitMqOperator(
                new ConnectionProvider(new ConnectionFactoryWrapper(
                                           new ConnectionFactory())));

            operat.DeleteQueueAsync(queueName).Wait();


            operat.CreateQueueAsync(queueName).Wait();
            operat.PushAsync(new Event(content)
            {
                EventType = q,
                QueueName = q
            }).Wait();

            var result = operat.NextAsync(queueName).Result;

            Assert.True(result.IsSuccessful);
            operat.CommitAsync(result.PollingResult).Wait();
            Assert.Equal(content, result.PollingResult.GetBody <string>());
        }
Exemple #3
0
        public WorkerRole()
        {
            _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(ImportFileProcessed)))
                       .ToList();


            var container = new WindsorContainer();

            _configurationValueProvider = new AzureConfigurationValueProvider();
            SetupDi(container, _configurationValueProvider, _pulsers.ToArray());
            _pulserPublisher = container.Resolve <PulserPublisher>();
            _orchestrator    = container.Resolve <Orchestrator>();

            // insert the list here
            var keyValueStore = container.Resolve <IDynamoStore>();
            var blob          = new SimpleBlob()
            {
                Body = Assembly.GetExecutingAssembly()
                       .GetManifestResourceStream("BeeHive.Sample.FileImport.Worker.Data.SampleData.txt"),
                Id           = "FileDrop/ImportFiles/SampleData.txt",
                LastModified = DateTimeOffset.Now
            };

            keyValueStore.UpsertAsync(blob);

            // add one topic that will not be created automagically by orchestrator
            // because no actor registered against it
            var q = container.Resolve <IEventQueueOperator>();

            q.CreateQueueAsync(QueueName.FromSimpleQueueName("NewIndexUpserted")).Wait();
        }
        public void TestSimpleQueue()
        {
            const string TheQueueName = "Hello";

            var inMemoryServiceBus = new InMemoryServiceBus();

            inMemoryServiceBus.CreateQueueAsync(TheQueueName);
            inMemoryServiceBus.PushAsync(new Event("Haya")
            {
                EventType = TheQueueName
            }).Wait();

            var pollerResult = inMemoryServiceBus.NextAsync(QueueName.FromSimpleQueueName(TheQueueName)).Result;

            Assert.True(pollerResult.IsSuccessful);
            Assert.Equal(TheQueueName, pollerResult.PollingResult.QueueName);
            Assert.Equal(TheQueueName, pollerResult.PollingResult.EventType);
            Assert.Equal("Haya", pollerResult.PollingResult.GetBody <string>());
        }