コード例 #1
0
        /// <summary>
        /// Raises the custom event on all Sitecore instances in the cluster (CM, CD, Publishing instance, etc.)
        /// The event is also raised on the local Sitecore instance, i.e., on the instance where the event is generated
        /// </summary>
        /// <param name="evt">Custom event that is routed</param>
        public static void PublishGlobally(this SitecoreEvent evt)
        {
            Assert.ArgumentNotNull((object)evt, "evt");

            if (!EventRegistry.IsEventRegistered(evt))
            {
                Log.Error(string.Format("Event '{0}' is not registered on this instance", evt.ToString()), typeof(SitecoreZone.Eventing.EventRouter));
            }

            evt.SetDefaultValues();
            //Queue events to global and local queues
            WrappedEvent wrappedEvent = new WrappedEvent() { Event = evt };
            EventManager.QueueEvent<WrappedEvent>(wrappedEvent, true, true);
        }
コード例 #2
0
        /// <summary>
        /// Raises the custom event on all remote Sitecore instances in the cluster that uses the target database
        /// The event will not be raised on the local Sitecore instance, i.e., the instance where the event is generated
        /// </summary>
        /// <param name="evt">Custom event that is routed</param>
        /// <param name="remoteTargetDB">Target database where event has to be raised</param>
        public static void PublishToRemoteTargetsOnly(this SitecoreEvent evt, Database remoteTargetDB)
        {
            Assert.ArgumentNotNull((object)evt, "evt");
            Assert.ArgumentNotNull((object)remoteTargetDB, "remoteTargetDB");

            if (!EventRegistry.IsEventRegistered(evt))
            {
                Log.Error(string.Format("Event '{0}' is not registered on this instance", evt.ToString()), typeof(SitecoreZone.Eventing.EventRouter));
            }

            evt.SetDefaultValues();
            //Queue events for remote
            WrappedEvent wrappedEvent = new WrappedEvent() { Event = evt };
            remoteTargetDB.RemoteEvents.Queue.QueueEvent<WrappedEvent>(wrappedEvent);
        }
コード例 #3
0
        /// <summary>
        /// Raises the custom event on all Sitecore instances in the cluster (CM, CD, Publishing instance, etc.)
        /// The event is also raised on the local Sitecore instance, i.e., on the instance where the event is generated
        /// </summary>
        /// <param name="evt">Custom event that is routed</param>
        public static void PublishGlobally(this SitecoreEvent evt)
        {
            Assert.ArgumentNotNull((object)evt, "evt");

            if (!EventRegistry.IsEventRegistered(evt))
            {
                Log.Error(string.Format("Event '{0}' is not registered on this instance", evt.ToString()), typeof(SitecoreZone.Eventing.EventRouter));
            }

            evt.SetDefaultValues();
            //Queue events to global and local queues
            WrappedEvent wrappedEvent = new WrappedEvent()
            {
                Event = evt
            };

            EventManager.QueueEvent <WrappedEvent>(wrappedEvent, true, true);
        }
コード例 #4
0
        /// <summary>
        /// Raises the custom event on all remote Sitecore instances in the cluster that uses the target database
        /// The event will not be raised on the local Sitecore instance, i.e., the instance where the event is generated
        /// </summary>
        /// <param name="evt">Custom event that is routed</param>
        /// <param name="remoteTargetDB">Target database where event has to be raised</param>
        public static void PublishToRemoteTargetsOnly(this SitecoreEvent evt, Database remoteTargetDB)
        {
            Assert.ArgumentNotNull((object)evt, "evt");
            Assert.ArgumentNotNull((object)remoteTargetDB, "remoteTargetDB");

            if (!EventRegistry.IsEventRegistered(evt))
            {
                Log.Error(string.Format("Event '{0}' is not registered on this instance", evt.ToString()), typeof(SitecoreZone.Eventing.EventRouter));
            }

            evt.SetDefaultValues();
            //Queue events for remote
            WrappedEvent wrappedEvent = new WrappedEvent()
            {
                Event = evt
            };

            remoteTargetDB.RemoteEvents.Queue.QueueEvent <WrappedEvent>(wrappedEvent);
        }
コード例 #5
0
 /// <summary>
 /// Event handler for remote events
 /// This method in turn generates local events on individual servers
 /// </summary>
 /// <param name="wrappedEvent">wrapped event</param>
 public void HandleRemoteEvent(WrappedEvent @wrappedEvent)
 {
     Log.Debug(string.Format("Handling remote event '{0}'", @wrappedEvent.Event.ToString()), this);
     @wrappedEvent.Event.PublishLocally();
 }
コード例 #6
0
 /// <summary>
 /// Event handler for remote events
 /// This method in turn generates local events on individual servers
 /// </summary>
 /// <param name="wrappedEvent">wrapped event</param>
 public void HandleRemoteEvent(WrappedEvent @wrappedEvent)
 {
     Log.Debug(string.Format("Handling remote event '{0}'", @wrappedEvent.Event.ToString()), this);
     @wrappedEvent.Event.PublishLocally();
 }