Exemplo n.º 1
0
 public SubmitModule(IPixMatch pixMatch, IPushMessages messagePusher, IUploadBlobImages blobUploader, IModeDecider modeDecider)
     : base("/api")
 {
     _pixMatch = pixMatch;
     _messagePusher = messagePusher;
     _blobUploader = blobUploader;
     _modeDecider = modeDecider;
     Get["/"] = parameters => HttpStatusCode.NotImplemented;
     Post["/submit"] = parameters => UploadImage();
 }
Exemplo n.º 2
0
        public RawTransportReceiver(IPushMessages pushMessages, IDispatchMessages dispatcher, Func <MessageContext, IDispatchMessages, Task> onMessage, PushSettings pushSettings, PushRuntimeSettings pushRuntimeSettings, CriticalError criticalError, RawEndpointErrorHandlingPolicy errorHandlingPolicy)
        {
            this.criticalError       = criticalError;
            this.errorHandlingPolicy = errorHandlingPolicy;
            this.pushRuntimeSettings = pushRuntimeSettings;
            this.pushSettings        = pushSettings;

            receiver       = pushMessages;
            this.onMessage = context => onMessage(context, dispatcher);
        }
Exemplo n.º 3
0
        public AdminModule(IPushMessages messagePusher)
            : base("/api")
        {
            _messagePusher = messagePusher;

            Get["/schema"] = parameters => BuildSchema();
            Get["/countdown"] = parameters => ChangeMode((int)AppMode.Countdown);
            Get["/gotime"] = parameters => ChangeMode((int)AppMode.GoTime);
            Get["/hangover"] = parameters => ChangeMode((int)AppMode.Hangover);

            Get["/viewsubs"] = parameters => ViewSubs();
        }
        public async Task <IStartableRawEndpoint> Initialize()
        {
            CreateCriticalErrorHandler();

            CreateStartupDiagnostics();

            var transportDefinition     = settings.Get <TransportDefinition>();
            var connectionString        = settings.GetConnectionString();
            var transportInfrastructure = transportDefinition.Initialize(settings, connectionString);

            settings.Set(transportInfrastructure);

            var mainInstance       = transportInfrastructure.BindToLocalEndpoint(new EndpointInstance(settings.EndpointName()));
            var baseQueueName      = settings.GetOrDefault <string>("BaseInputQueueName") ?? settings.EndpointName();
            var mainLogicalAddress = LogicalAddress.CreateLocalAddress(baseQueueName, mainInstance.Properties);
            var localAddress       = transportInfrastructure.ToTransportAddress(mainLogicalAddress);

            settings.SetDefault(mainLogicalAddress);

            IPushMessages        messagePump         = null;
            IManageSubscriptions subscriptionManager = null;

            if (!settings.GetOrDefault <bool>("Endpoint.SendOnly"))
            {
                RegisterReceivingComponent(settings, mainLogicalAddress, localAddress);

                var receiveInfrastructure = transportInfrastructure.ConfigureReceiveInfrastructure();
                var queueCreator          = receiveInfrastructure.QueueCreatorFactory();
                messagePump = receiveInfrastructure.MessagePumpFactory();
                var queueBindings = settings.Get <QueueBindings>();
                queueBindings.BindReceiving(localAddress);

                if (settings.GetOrDefault <bool>("NServiceBus.Raw.CreateQueue"))
                {
                    await queueCreator.CreateQueueIfNecessary(queueBindings, GetInstallationUserName()).ConfigureAwait(false);
                }

                if (transportInfrastructure.OutboundRoutingPolicy.Publishes == OutboundRoutingType.Multicast ||
                    transportInfrastructure.OutboundRoutingPolicy.Sends == OutboundRoutingType.Multicast)
                {
                    subscriptionManager = CreateSubscriptionManager(transportInfrastructure);
                }
            }

            var sendInfrastructure = transportInfrastructure.ConfigureSendInfrastructure();
            var dispatcher         = sendInfrastructure.DispatcherFactory();

            await transportInfrastructure.Start().ConfigureAwait(false);

            var startableEndpoint = new StartableRawEndpoint(settings, transportInfrastructure, CreateCriticalErrorHandler(), messagePump, dispatcher, subscriptionManager, onMessage, localAddress);

            return(startableEndpoint);
        }
Exemplo n.º 5
0
        public TransportReceiver(
            string id,
            IPushMessages pushMessages,
            PushSettings pushSettings,
            PushRuntimeSettings pushRuntimeSettings,
            IPipelineExecutor pipelineExecutor,
            RecoverabilityExecutor recoverabilityExecutor,
            CriticalError criticalError)
        {
            this.criticalError = criticalError;
            Id = id;
            this.pushRuntimeSettings    = pushRuntimeSettings;
            this.pipelineExecutor       = pipelineExecutor;
            this.recoverabilityExecutor = recoverabilityExecutor;
            this.pushSettings           = pushSettings;

            receiver = pushMessages;
        }
Exemplo n.º 6
0
        public TransportReceiver(
            string id,
            IPushMessages pushMessages,
            PushSettings pushSettings,
            PushRuntimeSettings pushRuntimeSettings,
            IPipelineExecutor pipelineExecutor,
            RecoverabilityExecutor recoverabilityExecutor,
            CriticalError criticalError)
        {
            this.criticalError = criticalError;
            Id = id;
            this.pushRuntimeSettings = pushRuntimeSettings;
            this.pipelineExecutor = pipelineExecutor;
            this.recoverabilityExecutor = recoverabilityExecutor;
            this.pushSettings = pushSettings;

            receiver = pushMessages;
        }
Exemplo n.º 7
0
 public StartableRawEndpoint(SettingsHolder settings, TransportInfrastructure transportInfrastructure, RawCriticalError criticalError, IPushMessages messagePump, IDispatchMessages dispatcher, IManageSubscriptions subscriptionManager, Func <MessageContext, IDispatchMessages, Task> onMessage, string localAddress)
 {
     this.criticalError           = criticalError;
     this.messagePump             = messagePump;
     this.dispatcher              = dispatcher;
     this.onMessage               = onMessage;
     this.localAddress            = localAddress;
     this.settings                = settings;
     this.transportInfrastructure = transportInfrastructure;
     SubscriptionManager          = subscriptionManager;
 }
 public DelayedDeliveryMessagePump(IPushMessages pump, DelayedMessageProcessor delayedMessageProcessor)
 {
     this.pump = pump;
     this.delayedMessageProcessor = delayedMessageProcessor;
 }