Friday, September 8, 2017

Sitecore- Inside Event Queue and Publish Queue(Master, Web, and Core).

Version: Sitecore.NET 8.2 (rev. 170407)
Here are some interesting information/working sessions about Sitecore #EventQuoueand #Publishing Queue, in case of #workflow, assigned and in case of #Normal and #schedule publishing.
EventQuoue- Just to update here about the EventQuoue - These Queue Sitecore use to maintain the communication between different- different databases - It captures the event and change/audit details, Core database capture event mostly related to Security and publishing(Rebuild indexes)
Before Sitecore 8.1, It only allows to clean up event older then 1 day, but that may create a problem when publishing is too much, especially if publish if very frequent. They have introduced IntervaleToKeep and that will help to determine ours to keep it alive.


  04:00:00
  1
Publishing Queue - This will be used mostly on Master and Web, a First time when the user does any change in the item, it stores details in publishing queue and event Queue and then will move to Web based on the publish type.

This is very useful in case of incremental publishing - As it only trigger and Async Sitecore changes, In case of Schedule publishing mostly this incremental publishing is being used, As most of the time it's required to enable future publishing for the whole site and comparing each change and publishing in a defined interval would be a performance issue, and secondly through incremental publishing the root can't be defined so this Queue will be helpful.
Sitecore keeps 30 days of publishing queue. We can change these configuration by


  10
#Important:- What if the content has been scheduled for publishing after 11days and publishing cleanup is setup for 10 days, that may create an issue so it should be communicated to the user that scheduled publishing maximum allow time will work based on this setting DayToKeep.
Sitecore has three key databases - Master, Web, and Core
Each database has these two tables. Will first clear these three tables and then run some scenarios and analyzed the data, isn't too exciting. Yes it's
Let's run this query - Please change your database name based on your local instance.
use localdevSitecore_Master
Delete from dbo.PublishQueue 
Delete from dbo.EventQueue
use localdevSitecore_Web
Delete from dbo.PublishQueue 
Delete from dbo.EventQueue
use localdevSitecore_Core
Delete from dbo.PublishQueue 
Delete from dbo.EventQueue
----------------------------------
use localdevSitecore_Master
select * from dbo.PublishQueue order by 1 desc
Select distinct *  from dbo.EventQueue
use localdevSitecore_Web
select * from dbo.PublishQueue order by 1 desc
Select distinct *  from dbo.EventQueue
use localdevSitecore_Core
select * from dbo.PublishQueue order by 1 desc
Select distinct *  from dbo.EventQueue
Make sure the result is blank for all these tables, PFB sample
Create the First item in Sitecore. - I got Item ID - {7F0D3720-9CC9-4D6C-9E80-0ABB8860C94B}
Master - dbo.PublishQueue - 3 Records - with actions below details.
Created, Saved and Version Added
Web- dbo.PublishQueue - 3 Records - with actions below details.
No Records
Core- dbo.PublishQueue - 0 Records but dbo.EventQueue got almost 21 records. Almost all are related to reference to index updations.
Point#1 - Master DB will have a reference for Item but Core DB will only have a reference for the Indexes ( Later on will discuss these indexes in context of multiple CD servers).
Point#2 - PublishingQueue will have high-level details and action like the item - added, saved etc.
EventQueue will have full details about field level change
Question#1 - There are four entries in Event Ques two are the almost same only difference in item name - Anyone knows why or any specific purpose?
Let's now publish this item -
I published this item in one language, here (out of the context) I got below message - One item created and one skipped
Question 2 - Why I got the message of one item skipped here? Many be will discuss this - let's continue here with the main topic.
As per my understanding, As we choose the smart publishing so only required changes moved from Master to the web or second we have only choose English - Not sure - Will review this in next session.
Result-
Master - dbo.PublishQueue - NO change.
#Question - What is DAC_Index?
#Question - What is Recovery ID - We noticed in instancdedatafield in CoreDatabase EventQueue

"EventName":"publish:startPublishing","Options":[{"CompareRevisions":true,"Deep":false,"FromDate":"\/Date(1504386516076)\/","LanguageName":"en","Mode":3,"PublishDate":"\/Date(1504391279790)\/","PublishRelatedItems":false,"PublishingTargets":["{8E080626-DDC3-4EF4-A1D1-F0BE4A200254}"],"RecoveryId":"0f06ba19-a91c-4b08-a7bf-54ebcb27572e","RepublishAll":false,"RootItemId":"7f0d3720-9cc9-4d6c-9e80-

Master - dbo.EventQueue- NO change.
Web- MasterPublishQueue - No change
Web- EventQueue - Got three records
First entry just for the publishing details, second for the item while field level details, third is high-level details of the events.
Core- PublishQueue- No change
Core- EventQueue - the last record was 21, not its 46 , Almost 21 new records are related to update the index but rest 4(46-(21+21)) are related to actual item event capture.
Let's review this four items.
First three are related to the user and the last one is related to job running status and owner is an Anonymous user.
{"EventName":"publish:statusUpdated","Status":{"CurrentLanguageName":"English","CurrentTargetName":"web","Expired":true,"Failed":false,"IsDone":true,"Messages":["Job started: Publish to 'web'","Items created: 1","Items deleted: 0","Items updated: 0","Items skipped: 1","Job ended: Publish to 'web' (units processed: 2)"],"Processed":2,"State":3},"StatusHandle":{"instanceName":"localdev","m_handle":"d0b296a2-a2ba-45d6-8d94-fa45c2452e85"}} localdev 1 1 default\Anonymous
What about in case of Schedule publishing -
Let's review this - First quickly enable the scheduled publishing, Add below configure in include folder, make sure it should have naming convention of z



 
   
     
        master
        web
        incremental
        en, ar
     
   
 

Now again flush all the content and quickly verify these transactions.
Let's observe the behavior of schedule publishing agent without any activities.
Notice - This agent will keep entering data in Code and Web EventQueu, As we have setup interval for 2 minutes and two languages it's entering 2 records in every two minutes.
I published this item.
Each item in event queue there is a field call Mode- which can be used to identify by what method this item get entered like smart, full or incremental(by Agent).
#Important - Sometimes we faced some issue where we identified record modified through custom utility or scheduling agent - this mode will be helpful If this is because of incremental publishing the most reason would be Schedule publishing agent.
Some useful References:-https://sdn.sitecore.net/upload/sitecore6/63/introducing_sitecore_cms_6.3_a4.pdf

No comments:

Post a Comment