Exemplo n.º 1
0
 public CreateSubscriptions(IServiceBusFactory serviceBusFactory, ElsaOptions elsaOptions, IContainerNameAccessor containerNameAccessor)
 {
     _serviceBusFactory     = serviceBusFactory;
     _containerNameAccessor = containerNameAccessor;
     _competingMessageTypes = elsaOptions.CompetingMessageTypes;
     _pubSubMessageTypes    = elsaOptions.PubSubMessageTypes;
 }
 public SlowTopicIntegrationTests()
 {
     factory  = new ServiceBusFactory(settings, log);
     sender   = factory.CreateSender <TestMessage>(topic);
     receiver = factory.CreateReceiver <ReleaseNotifierMessage>(topic, new SlowTopicMessageProcessor(this));
     receiver.Start();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructs a new instance of the <see cref="ServiceBusRealtimeDataRepository"/>.
 /// </summary>
 public ServiceBusRealtimeDataRepository(IPathDataRepository pathDataRepository, Flags flags, IServiceBusFactory managementClientFactory)
 {
     this.pathDataRepository               = pathDataRepository;
     this.managementClientFactory          = managementClientFactory;
     this.serviceBusSubscriptionId         = flags.ServiceBusSubscriptionId ?? Guid.NewGuid().ToString();
     this.pathDataRepository.OnDataUpdate += this.PathSqlDbUpdated;
     this.subscriptionClients              = new ConcurrentDictionary <Station, ISubscriptionClient>();
     this.realtimeData = new ConcurrentDictionary <Tuple <Station, RouteDirection>, List <RealtimeData> >();
 }
Exemplo n.º 4
0
 public UserDetailsTrigger(IRequestAuditRepository audit,
                           IUserDetailsEngine engine,
                           IServiceBusFactory serviceBus,
                           IStorageQueueFactory storageQueue)
 {
     _audit        = audit;
     _engine       = engine;
     _serviceBus   = serviceBus;
     _storageQueue = storageQueue;
 }
 public PurgeSubscriptions(
     IServiceBusFactory serviceBusFactory,
     ElsaOptions elsaOptions,
     ILogger logger,
     IDistributedLockProvider distributedLockProvider,
     string connectionString)
 {
     _serviceBusFactory       = serviceBusFactory;
     _elsaOptions             = elsaOptions;
     _logger                  = logger;
     _distributedLockProvider = distributedLockProvider;
     _managementClient        = new ServiceBusAdministrationClient(connectionString);
 }
        /// <summary>
        /// Get or create new service bus namespace in a resource group.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="resourceGroup"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static async Task <IServiceBusResource> GetOrCreateAsync(
            this IServiceBusFactory service, IResourceGroupResource resourceGroup,
            string name)
        {
            var resource = await Try.Async(() => service.GetAsync(resourceGroup,
                                                                  name));

            if (resource == null)
            {
                resource = await service.CreateAsync(resourceGroup, name);
            }
            return(resource);
        }
        public MassTransitBusEngine(IServiceBusFactory serviceBusFactory, MassTransitOptions options)
        {
            if (serviceBusFactory == null)
            {
                throw new ArgumentNullException(nameof(serviceBusFactory));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            _serviceBusFactory = serviceBusFactory;
            _options           = options;

            _logger = options.LoggerFactory.CreateLogger(nameof(MassTransitBusEngine));
        }
Exemplo n.º 8
0
        public CreateSubscriptions(IServiceBusFactory serviceBusFactory, ElsaOptions elsaOptions, IContainerNameAccessor containerNameAccessor)
        {
            _serviceBusFactory     = serviceBusFactory;
            _containerNameAccessor = containerNameAccessor;
            _competingMessageTypes = elsaOptions.CompetingMessageTypes.ToList();
            _pubSubMessageTypes    = elsaOptions.PubSubMessageTypes;

            var workflowChannelOptions = elsaOptions.WorkflowChannelOptions;
            var workflowChannels       = workflowChannelOptions.Channels.ToList();

            // For each workflow channel, register a competing message type for workflow definition and workflow instance consumers.
            foreach (var workflowChannel in workflowChannels)
            {
                _competingMessageTypes.Add(new CompetingMessageType(typeof(ExecuteWorkflowDefinitionRequest), ElsaOptions.FormatChannelQueueName <ExecuteWorkflowDefinitionRequest>(workflowChannel)));
                _competingMessageTypes.Add(new CompetingMessageType(typeof(ExecuteWorkflowInstanceRequest), ElsaOptions.FormatChannelQueueName <ExecuteWorkflowInstanceRequest>(workflowChannel)));
            }
        }
Exemplo n.º 9
0
        public SyncManager(IServiceBusFactory serviceBusFactory)
        {
            var messages = Observable
                           .Create <ChangeSummary>(async observer => {
                var client           = await serviceBusFactory.SubscriptionClientForName(ShipHubTopicNames.Changes);
                client.PrefetchCount = _BatchSize;

                // TODO: convert to batches?
                client.OnMessage(message => {
                    var changes = WebJobInterop.UnpackMessage <ChangeMessage>(message);
                    observer.OnNext(new ChangeSummary(changes));
                }, new OnMessageOptions()
                {
                    AutoComplete     = true,
                    AutoRenewTimeout = TimeSpan.FromMinutes(1), // Has to be less than 5 or subscription will idle and expire
                    // Should be at least be the number of partitions
                    MaxConcurrentCalls = 16
                });

                // When disconnected, stop listening for changes.
                return(Disposable.Create(() => client.Close()));
            })
                           .SubscribeOn(TaskPoolScheduler.Default)
                           .Publish()
                           .RefCount();

            var urgent    = messages.Where(x => x.IsUrgent);
            var coalesced = messages
                            .Where(x => !x.IsUrgent)
                            .Buffer(_WindowTimeout)
                            .Where(x => x.Count > 0)
                            .Select(x => ChangeSummary.UnionAll(x));

            Changes = Observable
                      .Merge(urgent, coalesced)
                      .SubscribeOn(TaskPoolScheduler.Default)
                      .Publish()
                      .RefCount();
        }
Exemplo n.º 10
0
 public EventPublisher(IServiceBusFactory serviceBusFactory)
 {
     _serviceBusFactory = serviceBusFactory;
 }
Exemplo n.º 11
0
 public CreateSubscriptions(IServiceBusFactory serviceBusFactory, ElsaOptions elsaOptions)
 {
     _serviceBusFactory = serviceBusFactory;
     _messageTypes      = elsaOptions.MessageTypes;
 }
Exemplo n.º 12
0
 public EventPublisher(IServiceBusFactory serviceBusFactory, ILogger <EventPublisher> logger)
 {
     _serviceBusFactory = serviceBusFactory;
     _logger            = logger;
 }
 public PairedMessagingProvider(ServiceBusConfiguration config, IServiceBusFactory serviceBusFactory) : base(config)
 {
     _factory = serviceBusFactory;
 }
 /// <summary>
 /// Create a new randomly named service bus namespace
 /// </summary>
 public static Task <IServiceBusResource> CreateAsync(
     this IServiceBusFactory service, IResourceGroupResource resourceGroup)
 {
     return(service.CreateAsync(resourceGroup, null));
 }
Exemplo n.º 15
0
 public CommandSender(IServiceBusFactory serviceBusFactory)
 {
     _serviceBusFactory = serviceBusFactory;
 }
Exemplo n.º 16
0
 public ShipHubQueueClient(IServiceBusFactory serviceBusFactory)
 {
     _factory = serviceBusFactory;
 }
Exemplo n.º 17
0
 public CreateSubscriptions(IServiceBusFactory serviceBusFactory, IEnumerable <Type> messageTypes)
 {
     _serviceBusFactory = serviceBusFactory;
     _messageTypes      = messageTypes;
 }
Exemplo n.º 18
0
 public ServiceBusService(IServiceBusFactory serviceBusFactory)
 {
     _serviceBusFactory = serviceBusFactory;
 }
 public SynchronousCommandDispatcher(IServiceBusFactory <IServiceBus> busFactory)
 {
     m_bus     = busFactory.Get();
     m_timeOut = TimeSpan.FromSeconds(60);
 }