static void ServerConfig(MicroservicePersistenceWrapper <Guid, MondayMorningBlues> wrapper) { PersistenceClient <Guid, MondayMorningBlues> persistence = null; //if ((sContext.RedisCache & RedisCacheMode.Server) > 0) //{ // cacheManager = RedisCacheHelper.Default<Guid, MondayMorningBlues>(e.Config.RedisCacheConnection()); //} wrapper.Pipeline .AddDebugMemoryDataCollector((c) => wrapper.Collector = c) .AddChannelIncoming("internalIn", boundaryLoggingEnabled: true) .CallOut(PersistenceCommandSet) //.AttachResourceProfile(new ResourceProfile("TrackIt")) //.AttachAzureServiceBusQueueListener("Myqueue") //.AttachCommand(new PersistenceBlahMemory()) .AttachPersistenceClient(out persistence) .Revert() .AddChannelOutgoing("internalOut", internalOnly: true) ////.AppendBoundaryLogger(bLogger) //.CallOut((c) => cpipeOut = c) .Revert(); wrapper.Persistence = persistence; }
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); }
static void ClientConfig(MicroservicePersistenceWrapper <Guid, MondayMorningBlues> wrapper) { PersistenceClient <Guid, MondayMorningBlues> persistence = null; wrapper.Pipeline .ConfigurationSetFromConsoleArgs(sContext.Switches) .AddDebugMemoryDataCollector((c) => wrapper.Collector = c) .AddChannelIncoming("internalOut") .AttachPersistenceClient(out persistence, "internalIn") .Revert() .AddChannelOutgoing("internalIn", internalOnly: true) .Revert(); }
private void TryInitPersistence(ConnectionClient con) { if (con == null || con.State != EConnectionState.ClientConnected) { return; } if (m_Persistence == null) { m_Persistence = new PersistenceClient(new GameEnvironmentClient()); } m_Persistence.SetConnection(con); }
private void TryInitPersistence(ConnectionClient con) { if (con == null || con.State != EConnectionState.ClientPlaying) { return; } if (Persistence == null) { Persistence = new PersistenceClient(new GameEnvironmentClient()); OnPersistenceInitialized?.Invoke(Persistence); } Persistence.SetConnection(con); }
static void Main(string[] args) { DebugMemoryDataCollector coll; //PersistenceManagerHandlerMemory<int, LightwaveMessage> pm = null; PersistenceManagerHandlerFileSystem <int, LightwaveMessage> pm = null; PersistenceClient <int, LightwaveMessage> pc = null; mservice = new MicroservicePipeline("PiO", description: "PiO Server"); mservice .AdjustPolicyTaskManagerForDebug() .ConfigurationSetFromConsoleArgs(args) .AddDebugMemoryDataCollector(out coll) .AddChannelIncoming("lightwave", "LightwaveRF UDP traffic", ListenerPartitionConfig.Init(1)) .AttachUdpListener(UdpConfig.UnicastAllIps(9761) , requestAddress: ("message", "in") , deserialize: (holder) => holder.SetObject(new LightwaveMessage(holder.Blob, (IPEndPoint)holder.Metadata), true)) .AttachCommand(async(ctx) => { //Do nothing var debug = pm.ChannelId; var rs = await pc.Create(ctx.Request.Message.Holder.Object as LightwaveMessage); }, ("message", "in")) //.AttachPersistenceManagerHandlerMemory((LightwaveMessage m) => m.Trans, (s) => int.Parse(s), out pm) .AttachPersistenceManagerFileSystem((LightwaveMessage m) => m.Trans, (s) => int.Parse(s), out pm) .AttachPersistenceClient(out pc) .Revert() .AddChannelOutgoing("status", "Outgoing UDP status", SenderPartitionConfig.Init(1)) .AttachUdpSender(UdpConfig.BroadcastAllIps(44723), serializer: new StatisticsSummaryLogUdpSerializer()) .Revert() .OnDataCollection ( (ctx, ev) => { ctx.Outgoing.Process(("status", null, null), ev.Data, 1, ProcessOptions.RouteExternal); } , DataCollectionSupport.Statistics ) ; mservice.StartWithConsole(args: args); }
public Worker(ILogger <Worker> logger, IConfiguration cfg, IHostEnvironment env) { this.logger = logger; var appUrl = cfg.GetValue <string>("AppUrl"); var persistenceUrl = cfg.GetValue <string>("PersistenceUrl"); var isDev = env.IsDevelopment(); this.appClient = new AppClient(appUrl); this.persistence = new PersistenceClient(persistenceUrl, new PaymentEventUpdater()); Func <TEvent, Task <ActionStatus> > Protect <TEvent>(Func <TEvent, Task <ActionStatus> > action) where TEvent : Event => SagaUtil.Protect(action, this.errors); var shopping = new SagaConfiguration("Shopping") .OnEvent(Protect((OrderCheckedOut evn) => appClient.Pay(evn.StreamId, evn.CorrelationId))) .OnEvent(Protect((PaymentRequested evn) => appClient.FinalizePayment(evn.StreamId, evn.CorrelationId, evn.Total, evn.Description))) .OnEvent(Protect((PaymentCompleted evn) => appClient.Dispatch(evn.OrderStreamId, evn.StreamId, evn.CorrelationId))) .EndOnEvent <PaymentCancelled>() .EndOnEvent <OrderDispatched>(); this.saga = new Saga.Saga(shopping, persistence, this.logger); }