public void CommandLocal1() { try { DebugMemoryDataCollector memp1; ICommandInitiator init; var p1 = new MicroservicePipeline(nameof(CommandLocal1), serviceReference: typeof(CommandLocal)) .AddDebugMemoryDataCollector(out memp1) //.AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddICommandInitiator(out init) .AddChannelIncoming("fredo") .AttachCommand(typeof(ITestCommandLocal1), (ctx) => { var message = ctx.RequestPayloadGet <string>(); ctx.ResponseSet(200, "howdy"); return(Task.FromResult(0)); } ) .Revert(); p1.Start(); var ok = init.Process <ITestCommandLocal1, string, string>("Hello").Result; p1.Stop(); } catch (Exception ex) { throw; } }
public void Error408() { try { var pipeOut = new MicroservicePipeline("out") .AdjustPolicyMicroservice((p, c) => { p.DispatcherUnresolvedRequestMode = DispatcherUnhandledAction.Ignore; p.DispatcherInvalidChannelMode = DispatcherUnhandledAction.Ignore; }) ; CommandInitiator init; pipeOut .AddCommandInitiator(out init) .AddChannelIncoming((c) => "return") .Start(); var rs = init.Process <string, string>("F1", "F2", "F3", "hello" , new RequestSettings() { WaitTime = TimeSpan.FromSeconds(5) }).Result; Assert.IsTrue(rs?.ResponseCode == 408); } catch (Exception ex) { throw; } }
public void TimeOut1() { try { var pipeOut = new MicroservicePipeline("out"); CommandInitiator init; pipeOut .AddChannelIncoming((c) => "return") .AttachCommandInitiator(out init) .Start(); var rs = init.Process <string, string>("F1", "F2", "F3", "hello" , new RequestSettings() { WaitTime = TimeSpan.FromSeconds(5) }).Result; Assert.IsTrue(rs?.ResponseCode == 408); } catch (Exception ex) { throw; } }
public void Setup1() { var pipeline = new MicroservicePipeline(nameof(Setup1)); //pipeline // .AdjustPolicyTaskManager((t,c) => t. }
/// <summary> /// This method stops the service. /// </summary> public override void Stop() { StopInternal(); Pipeline = new MicroservicePipeline(Name); mInit?.Invoke(this); }
static void Main(string[] args) { try { var pipeline1 = new MicroservicePipeline("AzureStorageTest1"); var pipeline2 = new MicroservicePipeline("AzureStorageTest2"); var mainMenu = new ConsoleMenu("Azure Storage DataCollector validation"); pipeline1 .ConfigurationSetFromConsoleArgs(args) .AddEncryptionHandlerAes("myid", Convert.FromBase64String("hNCV1t5sA/xQgDkHeuXYhrSu8kF72p9H436nQoLDC28="), keySize: 256) //.AddAzureStorageDataCollector(handler:"myid") ; mainMenu.AddMicroservicePipeline(pipeline1); mainMenu.AddMicroservicePipeline(pipeline2); mainMenu.AddOption("Aruba", (m, o) => pipeline1.Service.DataCollection.LogException(new Exception())); mainMenu.Show(); } catch (Exception ex) { throw; } }
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(); }
public void Create(string id , ICommunicationBridge bridgeOut, ICommunicationBridge bridgeIn, ICommunicationBridge bridgeMaster , TestMasterJobCommand masterjob , out PersistenceClient <Guid, BridgeMe> init, out DebugMemoryDataCollector memcollector) { var pipeline = new MicroservicePipeline(id) .AdjustPolicyTaskManagerForDebug() .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddDebugMemoryDataCollector(out memcollector) .AddChannelIncoming("local", internalOnly: true) .AttachCommand(masterjob) .Revert() .AddChannelIncoming("cresponse") .AttachListener(bridgeIn.GetListener()) .Revert() .AddChannelOutgoing("crequest") .AttachSender(bridgeOut.GetSender()) .AttachPersistenceClient("cresponse", out init) .Revert() .AddChannelBroadcast("negotiate") .AttachListener(bridgeMaster.GetListener()) .AttachSender(bridgeMaster.GetSender()) .AssignMasterJob(masterjob) .Revert() ; Add(id, pipeline, masterjob); }
public void Add(string id, MicroservicePipeline pipeline, TestMasterJobCommand masterjob) { Services.Add(id, pipeline); masterjob.OnMasterJobStateChange += (o, e) => MasterJobStateChange(o, e); masterjob.OnMasterJobCommunication += (o, e) => Log.Add(e); }
public void Test2() { ConfigResolverMemory cr20 = null, cr30 = null; var msp = new MicroservicePipeline(); msp.ConfigResolverSet(20, (ConfigResolverMemory r) => cr20 = r); msp.ConfigResolverSet(30, (ConfigResolverMemory r) => cr30 = r); Assert.IsTrue(msp.Configuration.Resolvers.Count() == 4); cr20.Add("valueset20", "one"); var value20 = msp.Configuration.PlatformOrConfigCache("valueset20"); Assert.IsTrue(value20 == "one"); cr30.Add("valueset20", "two"); var value30 = msp.Configuration.PlatformOrConfigCache("valueset20"); Assert.IsTrue(value30 == "one"); msp.Configuration.CacheFlush(); var value30b = msp.Configuration.PlatformOrConfigCache("valueset20"); Assert.IsTrue(value30b == "two"); msp.ConfigurationOverrideSet("valueset20", "three"); var value30c = msp.Configuration.PlatformOrConfigCache("valueset20"); Assert.IsTrue(value30c == "three"); }
public void Rewrite1() { try { CommandInitiator init; var ms = new MicroservicePipeline() .AddChannelIncoming("deadletter").Revert() .AddChannelIncoming("freddy") .AttachCommand(new RewriteCommandVerifyFail()) .AttachMessageRedirectRule( new ServiceMessageHeader("freddy", "one", "two") , new ServiceMessageHeader("findlay", "three", "four") ).Revert() .AddChannelIncoming("findlay") .AttachCommand(new RewriteCommandVerifySuccess()).Revert() .AddChannelOutgoing("response") ; ms.Start(); } catch (Exception ex) { throw; } }
public void TestMethod1() { try { var fabric = new ManualFabricBridge(); var bridgeOut = fabric[FabricMode.Queue]; var bridgein = fabric[FabricMode.Broadcast]; PersistenceClient <Guid, BridgeMe> init; DebugMemoryDataCollector memp1, memp2; var p1 = new MicroservicePipeline("Sender") .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddDebugMemoryDataCollector(out memp1) .AddChannelIncoming("cresponse") .AttachListener(bridgein.GetListener()) .Revert() .AddChannelOutgoing("crequest") .AttachSender(bridgeOut.GetSender()) .AttachPersistenceClient("cresponse", out init) .Revert() ; var p2 = new MicroservicePipeline("Receiver") .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddDebugMemoryDataCollector(out memp2) .AddChannelIncoming("crequest") .AttachListener(bridgeOut.GetListener()) .AttachCommand(new PersistenceManagerHandlerMemory <Guid, BridgeMe>((e) => e.Id, (s) => new Guid(s))) .Revert() .AddChannelOutgoing("cresponse") .AttachSender(bridgein.GetSender()) ; p2.ToMicroservice().Events.ExecuteBegin += CommunicationBridgeTests_OnExecuteBegin; p1.Start(); p2.Start(); int check1 = p1.ToMicroservice().Commands.Count(); int check2 = p2.ToMicroservice().Commands.Count(); var entity = new BridgeMe() { Message = "Momma" }; var rs = init.Create(entity, new RepositorySettings() { WaitTime = TimeSpan.FromMinutes(5) }).Result; var rs2 = init.Read(entity.Id).Result; Assert.IsTrue(rs2.IsSuccess); Assert.IsTrue(rs2.Entity.Message == "Momma"); } catch (Exception ex) { throw; } }
public void TestMethod1() { var pipeline = new MicroservicePipeline("AzureTest"); pipeline.Start(); pipeline.Stop(); }
public void Pipeline() { var pipe = new MicroservicePipeline(); pipe.Start(); pipe.Stop(); }
public void Setup1() { var pipeline = new MicroservicePipeline(nameof(Setup1)); //var hello = SimpleTestClass.Doesthiswork(); //pipeline // .AdjustPolicyTaskManager((t,c) => t. }
public void TestMethod1() { try { var bridgeOut = new CommunicationBridge(CommunicationBridgeMode.RoundRobin); var bridgein = new CommunicationBridge(CommunicationBridgeMode.Broadcast); PersistenceClient <Guid, BridgeMe> init; DebugMemoryDataCollector memp1, memp2; var p1 = new MicroservicePipeline("Sender") .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddDebugMemoryDataCollector(out memp1) .AddChannelIncoming("cresponse") .AttachListener(bridgein.GetListener()) .Revert() .AddChannelOutgoing("crequest") .AttachSender(bridgeOut.GetSender()) .AttachPersistenceClient("cresponse", out init) ; var p2 = new MicroservicePipeline("Receiver") .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddDataCollector((c) => new DebugMemoryDataCollector(), (c) => memp2 = c) .AddChannelIncoming("crequest") .AttachMessageRedirectRule( canRedirect: (p) => p.Message.MessageType.Equals("bridgeme", StringComparison.InvariantCultureIgnoreCase) , redirect: (p) => p.Message.MessageType = "BridgeMe2" ) .AttachListener(bridgeOut.GetListener()) .AttachCommand(new PersistenceManagerHandlerMemory <Guid, BridgeMe2>((e) => e.Id, (s) => new Guid(s))) .Revert() .AddChannelOutgoing("cresponse") .AttachSender(bridgein.GetSender()) ; p1.Start(); p2.Start(); int check1 = p1.ToMicroservice().Commands.Count(); int check2 = p2.ToMicroservice().Commands.Count(); var entity = new BridgeMe() { Message = "Momma" }; var rs = init.Create(entity, new RepositorySettings() { WaitTime = TimeSpan.FromSeconds(20) }).Result; Assert.IsTrue(!rs.IsSuccess && rs.ResponseCode == 422); } catch (Exception ex) { throw; } }
public void Tcp1() { try { var bridgeOut = new CommunicationBridge(CommunicationBridgeMode.RoundRobin, new TcpCommunicationBridgeAgent(new IPEndPoint(IPAddress.Loopback, 8088))); var bridgein = new CommunicationBridge(CommunicationBridgeMode.Broadcast, new TcpCommunicationBridgeAgent(new IPEndPoint(IPAddress.Loopback, 8088))); PersistenceClient <Guid, BridgeMe> init; DebugMemoryDataCollector memp1, memp2; var p1 = new MicroservicePipeline("Sender") .AdjustPolicyCommunicationBoundaryLoggingActive() .AddDebugMemoryDataCollector(out memp1) .AddChannelIncoming("cresponse") .AttachListener(bridgein.GetListener()) .Revert() .AddChannelOutgoing("crequest") .AttachSender(bridgeOut.GetSender()) .AttachPersistenceClient("cresponse", out init) .Revert() ; var p2 = new MicroservicePipeline("Receiver") .AdjustPolicyCommunicationBoundaryLoggingActive() .AddDebugMemoryDataCollector(out memp2) .AddChannelIncoming("crequest") .AttachListener(bridgeOut.GetListener()) .AttachPersistenceManagerHandlerMemory((BridgeMe e) => e.Id, (s) => new Guid(s)) .Revert() .AddChannelOutgoing("cresponse") .AttachSender(bridgein.GetSender()) ; p2.ToMicroservice().Events.ExecuteBegin += CommunicationBridgeTests_OnExecuteBegin; p1.Start(); p2.Start(); int check1 = p1.ToMicroservice().Commands.Count(); int check2 = p2.ToMicroservice().Commands.Count(); var entity = new BridgeMe() { Message = "Momma" }; var rs = init.Create(entity, new RepositorySettings() { WaitTime = TimeSpan.FromMinutes(5) }).Result; var rs2 = init.Read(entity.Id).Result; Assert.IsTrue(rs2.IsSuccess); Assert.IsTrue(rs2.Entity.Message == "Momma"); } catch (Exception ex) { throw; } }
public void PersistenceSingle() { try { PersistenceClient <Guid, Sample1> repo; var p1 = new MicroservicePipeline("Local") .AddChannelIncoming("request") .AttachPersistenceManagerHandlerMemory( keyMaker: (Sample1 e) => e.Id , keyDeserializer: (s) => new Guid(s) , versionPolicy: ((e) => e.VersionId.ToString("N").ToUpperInvariant(), (e) => e.VersionId = Guid.NewGuid(), true) ) .AttachPersistenceClient(out repo) .Revert() ; p1.Start(); var sample = new Sample1() { Message = "Hello mom" }; var id = sample.Id; //Run a set of simple version entity tests. //Create Assert.IsTrue(repo.Create(sample).Result.IsSuccess); //Read var result = repo.Read(id).Result; Assert.IsTrue(result.IsSuccess); Assert.IsTrue(result.Entity.Message == "Hello mom"); //Update success var rs = repo.Update(sample).Result; Assert.IsTrue(rs.IsSuccess); //We have enabled version policy and optimistic locking so the next command should fail. //Update fail as old version Assert.IsFalse(repo.Update(sample).Result.IsSuccess); //But this one should pass. //Update pass as new entity. Assert.IsTrue(repo.Update(rs.Entity).Result.IsSuccess); //Read Assert.IsTrue(repo.Read(sample.Id).Result.IsSuccess); //Delete Assert.IsTrue(repo.Delete(sample.Id).Result.IsSuccess); //Read fail. Assert.IsFalse(repo.Read(sample.Id).Result.IsSuccess); p1.Stop(); } catch (Exception ex) { throw; } }
public void RPipeInternal() { PersistenceClient <Guid, PipeTest1> persistence, persistence2; CommandInitiator init; var server = new MicroservicePipeline(nameof(RPipeInternal)); server.ToMicroservice().Events.ProcessRequestError += Events_ProcessRequestError; server.ToMicroservice().Events.ProcessRequestUnresolved += Events_ProcessRequestUnresolved; server .AddChannelIncoming("inChannel") .AttachPersistenceManagerHandlerMemory((PipeTest1 e) => e.Id, (s) => new Guid(s), resourceProfile: "Entity") .AttachPersistenceClient(out persistence) .Revert() .AddChannelIncoming("inChannel2") .AttachPersistenceClient(out persistence2) .Revert() .AddChannelIncoming("backout") .AttachCommandInitiator(out init) ; server.Start(); var result = persistence.Create(new PipeTest1() { Message = "Hello" } , new RepositorySettings() { WaitTime = TimeSpan.FromSeconds(5) } ).Result; Assert.IsTrue(result.ResponseCode == 201); var result2 = persistence2.Create(new PipeTest1() { Message = "Hello" } , new RepositorySettings() { WaitTime = TimeSpan.FromSeconds(5) } ).Result; Assert.IsTrue(result2.ResponseCode == 501); var result3 = init.Process <string, string>(("franky", "four", "fingers"), "" , new RequestSettings { WaitTime = TimeSpan.FromSeconds(5) }, routing: ProcessOptions.RouteInternal ).Result; Assert.IsTrue(result3.ResponseCode == 501); }
static void Main(string[] args) { var pipeline = new MicroservicePipeline("Server"); pipeline.Start(); Console.WriteLine("Press a key to stop."); Console.ReadKey(); pipeline.Stop(); Console.WriteLine("Service stopped."); Console.ReadKey(); }
public void TableStorageValidate2() { var ms1 = new MicroservicePipeline(); ms1 .ConfigResolverSetTestContext(TestContext) .ConfigResolverSetTableStorage() .ConfigResolverSetTableStorage(AzureExtensionMethods.AzureTableStorageConfigDefaultPriority + 1, partitionKey: "otherconfig") ; Assert.IsTrue(ms1.Configuration.PlatformOrConfigCache("my_key") == "ABCDEF"); }
public void PersistenceLocal1() { try { DebugMemoryDataCollector memp1; PersistenceClient <Guid, Sample1> init; var p1 = new MicroservicePipeline(nameof(PersistenceLocal1)) .AddDebugMemoryDataCollector(out memp1) .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddChannelIncoming("fredo") .AttachPersistenceManagerHandlerMemory( (Sample1 e) => e.Id, (s) => new Guid(s) , versionPolicy: ((e) => e.VersionId.ToString("N").ToUpperInvariant(), (e) => e.VersionId = Guid.NewGuid(), true) , resourceProfile: ("paul1", true) ) .AttachPersistenceClient(out init) .Revert() ; p1.Start(); var sample = new Sample1(); //Run a set of simple version entity tests. //Create Assert.IsTrue(init.Create(sample).Result.IsSuccess); //Read Assert.IsTrue(init.Read(sample.Id).Result.IsSuccess); //Update success var rs = init.Update(sample).Result; Assert.IsTrue(rs.IsSuccess); //We have enabled version policy and optimitic locking so the next command should fail. //Update fail as old version Assert.IsFalse(init.Update(sample).Result.IsSuccess); //But this one should pass. //Update pass as new entity. Assert.IsTrue(init.Update(rs.Entity).Result.IsSuccess); //Read Assert.IsTrue(init.Read(sample.Id).Result.IsSuccess); //Delete Assert.IsTrue(init.Delete(sample.Id).Result.IsSuccess); //Read fail. Assert.IsFalse(init.Read(sample.Id).Result.IsSuccess); p1.Stop(); } catch (Exception ex) { throw; } }
public void TestReroute() { var bridgeOut = new ManualCommunicationBridgeAgent(new ManualFabricBridge(), CommunicationBridgeMode.RoundRobin); bool success = false; ManualResetEvent mre = new ManualResetEvent(false); DebugMemoryDataCollector memp1, memp2; var p1 = new MicroservicePipeline("Sender") .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddDebugMemoryDataCollector(out memp1) .AddChannelIncoming("fredo") .AttachCommand(typeof(IContractInitial), (ctx) => { ctx.Responses.Add(new TransmissionPayload(ctx.Request.Message.Clone().SetDestination <IContractFinal>())); return(Task.FromResult(0)); }) .Revert() .AddChannelOutgoing("crequest") .AttachSender(bridgeOut.GetSender()) .Revert() ; var p2 = new MicroservicePipeline("Receiver") .AdjustPolicyCommunication((p, c) => p.BoundaryLoggingActiveDefault = true) .AddDebugMemoryDataCollector(out memp2) .AddChannelIncoming("crequest") .AttachListener(bridgeOut.GetListener()) .AttachCommand(typeof(IContractFinal), (ctx) => { var value = ctx.PayloadSerializer.PayloadDeserialize <string>(ctx.Request); success = value == "Hello"; mre.Set(); return(Task.FromResult(0)); }) .Revert() ; p1.Start(); p2.Start(); //Send the message to the command asynchronously. p1.ToMicroservice().Dispatch.Process <IContractInitial>("Hello"); mre.WaitOne(); Assert.IsTrue(success); p1.Stop(); p2.Stop(); }
public void Pipeline1() { //var fabric = new ManualFabricBridge(); var fabric = new AzureServiceBusFabricBridge(connMgmt); var server = new MicroservicePipeline() .ConfigResolverSetTestContext(TestContext) .FabricConfigure(fabric) .AdjustPolicyTaskManagerForDebug() .AddChannelIncoming("incoming") .AttachListener(fabric.Queue.GetListener()) .AttachCommand((ctx) => { var incoming = ctx.RequestPayloadGet <string>(); ctx.ResponseSet(200, "Howdy"); return(Task.FromResult(0)); } , ("one", "two")) .Revert() .AddChannelOutgoing("outgoing") .AttachSender(fabric.Broadcast.GetSender()) .Revert() ; ICommandInitiator init; var client = new MicroservicePipeline() .ConfigResolverSetTestContext(TestContext) .AdjustPolicyTaskManagerForDebug() .AddChannelOutgoing("incoming") .AttachSender(fabric.Queue.GetSender()) .Revert() .AddChannelIncoming("outgoing") .AttachListener(fabric.Broadcast.GetListener()) .AttachICommandInitiator(out init) .Revert() ; server.Start(); client.Start(); int t1 = Environment.TickCount; var result1 = init.Process <string, string>(("incoming", "one", "two"), "Hello").Result; int t2 = Environment.TickCount; var result2 = init.Process <string, string>(("incoming", "one", "two"), "Hello").Result; int t3 = Environment.TickCount; var result3 = init.Process <string, string>(("incoming", "one", "two"), "Hello").Result; int t4 = Environment.TickCount; }
public void Pipeline() { var pipe = new MicroservicePipeline(); pipe .AddChannelIncoming("freddyin", autosetPartition01: false) .AttachPriorityPartition(0, 1, 2) .Revert() .AddChannelOutgoing("freddyout", autosetPartition01: false) .AttachPriorityPartition(1, 2) ; pipe.Start(); pipe.Stop(); }
public void Initialise() { mMs = new MicroservicePipeline(); mMs.AddChannelIncoming("internal") .AttachPersistenceManagerHandlerMemory((MyTestEntity1 e) => e.Id, (e) => new Guid(e)) .AttachPersistenceManagerHandlerMemory((MyTestEntity2 e) => e.Id , (e) => new Guid(e) , versionPolicy: new VersionPolicy <MyTestEntity2>((e) => e.VersionId.ToString("N").ToUpperInvariant(), (e) => e.VersionId = Guid.NewGuid()) ) .AttachPersistenceClient(out mPersistenceService1) .AttachPersistenceClient(out mPersistenceService2) ; mMs.Start(); }
/// <summary> /// The default constructor. /// </summary> /// <param name="name">The service name.</param> /// <param name="configure">This is the link to configuration pipeline for the Microservice</param> public MicroservicePersistenceWrapper(string name , Action <MicroservicePersistenceWrapper <K, E> > configure , Action <MicroservicePersistenceWrapper <K, E> > init = null) { if (configure == null) { throw new ArgumentNullException("configure"); } Name = name; Pipeline = new MicroservicePipeline(name); mConfigure = configure; mInit = init; mInit?.Invoke(this); }
public void TestMethod1() { CommandInitiator init; try { var sender = new MicroservicePipeline("initiator") .ConfigurationOverrideSet(AzureServiceBusExtensionMethods.KeyServiceBusConnection, SbConn) .AddChannelOutgoing("remote") .AttachAzureServiceBusQueueSender() .Revert() .AddChannelIncoming("response") .AttachAzureServiceBusTopicListener(listenOnOriginatorId: true) .AttachCommandInitiator(out init) ; var listener = new MicroservicePipeline("responder") .ConfigurationOverrideSet(AzureServiceBusExtensionMethods.KeyServiceBusConnection, SbConn) .AddChannelIncoming("remote") .AttachAzureServiceBusQueueListener() .AttachCommand(new SimpleCommand()) .Revert() .AddChannelIncoming("deadletter") .AttachMessageRedirectRule((p) => true, new ServiceMessageHeader("remote", "process", "deadletter")) .AttachAzureServiceBusQueueListener("remote", isDeadLetterListener: true) .Revert() .AddChannelOutgoing("response") .AttachAzureServiceBusTopicSender() ; listener.Start(); sender.Start(); var rs = init.Process <ISimpleCommand, string, string>("hello")?.Result; Assert.IsTrue(rs?.Response == "mom"); sender.Stop(); listener.Stop(); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void Test1() { var msp = new MicroservicePipeline(); msp.ConfigurationOverrideSet("override", "one"); var value1 = msp.Configuration.PlatformOrConfigCache("override"); Assert.IsTrue(value1 == "one"); msp.ConfigurationOverrideSet("override", "two"); var value2 = msp.Configuration.PlatformOrConfigCache("override"); Assert.IsTrue(value2 == "two"); msp.Start(); msp.Stop(); }