Exemplo n.º 1
0
        protected virtual void Init()
        {
            var fabric    = new ManualFabricBridge();
            var bridgeOut = fabric[FabricMode.Queue];
            var bridgein  = fabric[FabricMode.Broadcast];

            mWebApi = new UnityWebApiMicroservicePipeline("Web")
                      .CallOut(WebApiConfigure)
                      .AddChannelOutgoing("Request", "This is the outgoing request channel")
                      .AttachSender(mBridgeRequest.GetSender())
                      .Revert()
                      .AddChannelIncoming("Response", "This is the response channel back from the Service")
                      .AttachListener(mBridgeResponse.GetListener())
                      .Revert();


            mService1 = new MicroservicePipeline("Service")
                        .CallOut(ServiceConfigure)
                        .AddChannelIncoming("Request", "This is the incoming request channel from the API")
                        .AttachListener(mBridgeRequest.GetListener())
                        .Revert()
                        .AddChannelOutgoing("Response", "This is the outgoing request channel")
                        .AttachSender(mBridgeResponse.GetSender())
                        .Revert()
            ;


            mService1.Start();
            mWebApi.Start();
        }
        protected virtual void Init()
        {
            mBridgeRequest  = new CommunicationBridge(CommunicationBridgeMode.RoundRobin);
            mBridgeResponse = new CommunicationBridge(CommunicationBridgeMode.Broadcast);

            mWebApi = new UnityWebApiMicroservicePipeline("Web")
                      .CallOut(WebApiConfigure)
                      .AddChannelOutgoing("Request", "This is the outgoing request channel")
                      .AttachSender(mBridgeRequest.GetSender())
                      .Revert()
                      .AddChannelIncoming("Response", "This is the response channel back from the Service")
                      .AttachListener(mBridgeResponse.GetListener())
                      .Revert();


            mService1 = new MicroservicePipeline("Service")
                        .CallOut(ServiceConfigure)
                        .AddChannelIncoming("Request", "This is the incoming request channel from the API")
                        .AttachListener(mBridgeRequest.GetListener())
                        .Revert()
                        .AddChannelOutgoing("Response", "This is the outgoing request channel")
                        .AttachSender(mBridgeResponse.GetSender())
                        .Revert()
            ;


            mService1.Start();
            mWebApi.Start();
        }
Exemplo n.º 3
0
        public void TestMethod2()
        {
            try
            {
                var pipe = new UnityWebApiMicroservicePipeline();

                pipe
                .AddChannelIncoming("freddyin", autosetPartition01: false)
                .AttachPriorityPartition(0, 1, 2)
                .AttachCommandUnity(typeof(IHello), new CommandHello(), responseChannel: new Channel("freda", ChannelDirection.Incoming))
                .Revert()
                .AddChannelOutgoing("freddyout", autosetPartition01: false)
                .AttachPriorityPartition(1, 2)
                ;

                var result = pipe.Unity.Resolve(typeof(IHello));
                Assert.IsNotNull(result);
                Assert.IsTrue(((ICommand)result).ResponseChannelId == "freda");

                pipe.Start();

                pipe.Stop();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public void PipelineUnityWebApi()
        {
            var pipe = new UnityWebApiMicroservicePipeline();

            //pipe.AddSharedService(
            pipe.Start();

            pipe.Stop();
        }
Exemplo n.º 5
0
        public void PipelineUnityWebApi()
        {
            var pipe = new UnityWebApiMicroservicePipeline();

            pipe
            .AddChannelIncoming("freddyin", autosetPartition01: false)
            .AttachPriorityPartition(0, 1, 2)
            .Revert()
            .AddChannelOutgoing("freddyout", autosetPartition01: false)
            .AttachPriorityPartition(1, 2)
            ;

            pipe.Start();

            pipe.Stop();
        }
        public void Configuration(IAppBuilder app)
        {
            var webpipe = new UnityWebApiMicroservicePipeline();
            PersistenceClient <Guid, MyStuff> init;

            webpipe
            .ApiConfig((c) => c.Routes.MapHttpRoute("Default", "api/{controller}/{id}", new { id = RouteParameter.Optional }))
            .ApiConfig((c) => c.Services.Replace(typeof(IHttpControllerSelector), new BypassCacheSelector(c)))
            .ApiAddMicroserviceUnavailableFilter()
            .ApiAddBoundaryLoggerFilter()
            .ApiAddJwtTokenAuthentication(JwtHashAlgorithm.HS256, mSecret, audience: JwtTests.Audience)
            .AddChannelIncoming("incoming", internalOnly: true)
            .AttachCommand(new PersistenceManagerHandlerMemory <Guid, MyStuff>((e) => e.Id, (s) => new Guid(s)))
            .Revert()
            .AddChannelOutgoing("outgoing", internalOnly: true)
            .AttachPersistenceMessageInitiatorUnity(out init, "incoming")
            .Revert()
            //.AttachCommand(new Per
            ;

            webpipe.StartWebApi(app);
        }
Exemplo n.º 7
0
 protected abstract void WebApiConfigure(UnityWebApiMicroservicePipeline pipeline);
Exemplo n.º 8
0
 /// <summary>
 /// This is a helper method that identifies the current pipeline. It is useful for autocomplete identification.
 /// This command does not do anything.
 /// </summary>
 /// <param name="pipe">The pipeline.</param>
 public static void Ability_Is_UnityWebApiMicroservicePipeline(this UnityWebApiMicroservicePipeline pipe)
 {
 }
Exemplo n.º 9
0
        public void Configuration(IAppBuilder app)
        {
            var pipeline = new UnityWebApiMicroservicePipeline();

            pipeline.CallOut(Hello1);
        }
Exemplo n.º 10
0
 private void Hello1(UnityWebApiMicroservicePipeline pipe)
 {
 }