protected override async Task PostAsync(IOwinContext context, PluginMessage message) { var restartMessage = new ApplicationRestartPortalBusMessage(); if (restartMessage.Validate(message)) { ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Post: name={0}", message.Target.Name)); await PortalBusManager <ApplicationRestartPortalBusMessage> .PostAsync(context, new ApplicationRestartPortalBusMessage()).WithCurrentCulture(); } }
public static void UseAppDataPortalBus <TMessage>(this IAppBuilder app, AppDataPortalBusOptions <TMessage> options) { try { PortalBusManager <TMessage> .Subscribe(new AppDataPortalBusProvider <TMessage>(app, options)); } catch (Exception e) { WebEventSource.Log.GenericErrorException(new Exception($"PortalBus error: InstanceId: {options.InstanceId}", e)); throw; } }
public override void Remove(OrganizationServiceCachePluginMessage message) { message.ThrowOnNull("message"); ADXTrace.Instance.TraceInfo(TraceCategory.Application, "Begin"); IOwinContext context = null; if (HttpContext.Current != null) { try { context = HttpContext.Current.GetOwinContext(); } catch (Exception) { ADXTrace.Instance.TraceInfo(TraceCategory.Application, "No owin.Environment item was found in the context"); return; } } var portalBusMessage = new CacheInvalidationPortalBusMessage { Message = message }; if (this._syncRemoveEnabled) { ADXTrace.Instance.TraceInfo(TraceCategory.Application, "Sending messages syncronously"); var task = PortalBusManager <CacheInvalidationPortalBusMessage> .SendAsync(context, portalBusMessage).WithCurrentCulture(); task.GetAwaiter().GetResult(); } else { this.RemoveLocal(message); ADXTrace.Instance.TraceInfo(TraceCategory.Application, "Sending messages asyncronously"); HostingEnvironment.QueueBackgroundWorkItem(ct => PortalBusManager <CacheInvalidationPortalBusMessage> .SendAsync(context, portalBusMessage)); } ADXTrace.Instance.TraceInfo(TraceCategory.Application, "End"); }
public static void UseRoleEnvironmentPortalBus <TMessage>(this IAppBuilder app, ServiceDefinitionPortalBusOptions <TMessage> options) { app.Use <PortalBusMiddleware <TMessage> >(app, options); PortalBusManager <TMessage> .Subscribe(new RoleEnvironmentPortalBusProvider <TMessage>(app, options)); }
public static void UseLocalOnlyPortalBus <TMessage>(this IAppBuilder app) { PortalBusManager <TMessage> .Subscribe(new LocalOnlyPortalBusProvider <TMessage>(app)); }