Technically you could run a custom SQL query to see if a server completed execution of a Remote Event
, but I wouldn't recommend it.
When you say:
Is there anyway i can get notified except watching for EventQueue
table status?
This operation happens automatically when the EventProvider
polls the various [EventQueue]
tables. Therefore, part of what you need to accomplish is already done for you.
What you need to do
Generally speaking, you need to create a RemoteEvent
type (e.g. MyCmEvent), and subscribe to this type on initialization.
Custom Type
[DataContract]
public class MyCmEvent
{
public MyCmEvent(string instanceName)
{
InstanceName = instanceName;
}
[DataMember]
public string InstanceName { get; protected set; }
}
Add type to subscription mapping
public class MyCmEventRemoteMap
{
public static void Initialize()
{
EventManager.Subscribe<MyCmEvent>(new Action<MyCmEvent>(StoreFactRemoteEventRan<MyCmEvent>));
}
private static void StoreFactRemoteEventRan<TEvent>(TEvent @event)
{
// build your primary logic here to store the fact that this event ran, set property in memory, update an item, whatever fits your needs
}
}
Config needed
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="MyNamespace.MyCmEventRemoteMap, MyDll" method="Initialize" />
</initialize>
</pipelines>
</sitecore>
</configuration>
From CM Server
From your CM server, when you need to trigger this code, you would call:
var myCmEvent= new MyCmEvent(Sitecore.Configuration.Settings.InstanceName);
EventManager.QueueEvent<MyCmEvent>(myCmEvent);
The above code will add a record to the System Event Queue, and set it to run globally, i.e. on CD server(s).
Notice in the StoreFactRemoteEventRan
method, you need to store the fact that the RemoteEvent
executed. However you end up storing this, you will need to read it wherever you want to display the message on your CD servers. I'm making an assumption that you have multiple CD servers, so likely need to store something in the database- either on an item or in the Core DB -> [Properties]
table (it's good for this type of thing).