February 6, 2012

Remote events how to investigate

I had some issues with the sitecore remote events not triggered on the content delivery. I will explain how you can investigate why it could happened and how to fix it.


First of all, how sitecore handle the remote events when you use the scalability?


When you publish an item in sitecore, sitecore will write a line in the EventQueue table of the corresponding database with all the necessary data including the InstanceName of the server who have triggered the event.

After that sitecore have an timer who check in this table if they are any event to trigger. First remark, sitecore look at the InstanceName field to know if this instance need to trigger this record or not so this instance need to be unique (be carefull with the copy paste) ;-).


Here is what sitecore add in the web database in the EventQueue when you publish an item:
Id 82480059-8CF4-4D2E-82B1-9C00323F12F2
EventType Sitecore.Eventing.Remote.PublishEndRemoteEvent, Sitecore.Kernel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null
InstanceType Sitecore.Eventing.Remote.PublishEndRemoteEvent, Sitecore.Kernel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null
InstanceData {"CompareRevisions":true,"Deep":false,"FromDate":"\/Date(-5339901827822+0200)\/","LanguageName":"en","Mode":3,"PublishDate":"\/Date(1328532964271+0100)\/","PublishingTargets":["{8E080626-DDC3-4EF4-A1D1-F0BE4A200254}","{8E080626-DDC3-4EF4-A1D1-F0BE4A200254}"],"RepublishAll":false,"RootItemId":"ebff6e2a-9149-4660-9d55-dec34282f856","SourceDatabaseName":"master","TargetDatabaseName":"web"}
InstanceName GRNQ6R1-sitecore650up3
RaiseLocally 0
RaiseGlobally 1
UserName sitecore\admin
Stamp 0x0000000000079C0F
Created 2012-02-06 12:56:07.033


The most important columns are :
  • "InstanceName": it is the server who have triggered the event. (setting "InstanceName" from ScalabilitySettings.config)
  • "EventType": The type of event: item:saved:remote, publish:end:remote, ...
  • "InstanceData": The data required to perform this operation

This is the first method to see if your events are trigered.

For the second method, you need to set in the web.config of each server the <events timingLevel="high"> setting (this setting is set to custom by default).
With this modification you should have any line like this for each event handled by sitecore in your log on both content delivery and content management instances.
Heartbeat 14:22:05 INFO  Event started: publish:statusUpdated
Heartbeat 14:22:05 INFO  Executed: Sitecore.Publishing.RemotePublishingEventHandler.OnStatusUpdated(). Elapsed: 4,23265309264199
Heartbeat 14:22:05 INFO  Event ended: publish:statusUpdated. Elapsed: 4,33442834380877

If even with all those informations your events are not triggered or triggered but not received in by the other server you can try to cleanup the temporary event tables.
On each database execute those scripts:
DELETE FROM EventQueue;
DELETE FROM [Properties] WHERE  [Key] LIKE 'EQStamp%';

I don't know exactly what is the EQStamp% setting but it was the solution provided by the support and it has solved my problem :) If anybody know what is is exactly you can post a comment.

Be also careful to the exception in your events because if one event of the pipeline throw an exception the other one will be not executed.

2 comments:

  1. Great post! I know I'm two years late, but the EQStamp piece is what the pipeline uses to write when it last processed the queue. This lets the event queue monitor know which events it should be looking at when it next processes so it doesn't re-process the same events.

    I found this out when trying to debug issues with the event queue recently.

    ReplyDelete
  2. Thank you very much. I was able to resolve mine with the help of this blog.

    ReplyDelete