I am using the Publishing Service in a Sitecore 10.2 Production environment. We use deployment slots in Azure App Services. Each deployment slot has a dedicated Web database, Slot 1 has Web and Slot 2 has Web2.
The publishing targets in the publishing service are setup and I am able to publish to both. However, only the Slot 1 CD updates it content. The Slot 2 CD tied to Web2 only updates if I restart the Slot Web App.
On the 2nd Slot, I have my connectionString named as "web" just like the first slot but it's database entry for the connectionString is to the web2 database.
I suspect that the events of publishing are getting discarded/not read by the Slot 2 CD Web App.
How should I configure my 2nd Slot Web App so that it updates on publish without restarting the whole app?
My Sitecore.Publishing.Service.Delivery.config is the default that comes with the Publishing Service Module:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<hooks>
<hook type="Sitecore.Publishing.Service.Delivery.PublishTargetEventsHook, Sitecore.Publishing.Service.Delivery" resolve="true"/>
</hooks>
<!--
SITECORE EVENTS
-->
<events>
<event name="publishingservice:searchindex:rebuild">
<handler type="Sitecore.Publishing.Service.Delivery.TargetSearchIndexRebuildHandler, Sitecore.Publishing.Service.Delivery" method="RebuildTargetSearchIndex">
<IndexNames hint="list:AddIndex">
<index>sitecore_web_index</index>
</IndexNames>
</handler>
</event>
<event name="publishingservice:cache:clear">
<handler type="Sitecore.Publishing.Service.Delivery.TargetDataCacheClearHandler, Sitecore.Publishing.Service.Delivery" method="ClearTargetDataCaches" />
</event>
</events>
</sitecore>
</configuration>
Update: I have added a 2nd connectionString to my CD2 and the following configuration to use web2 (which properly applies website to be using web2), but the content is still not showing unless I restart the server (this could be either a CMS or the CD2 Web App restart).
Of note: In checking the Sitecore Desktop Content Editor, my publishing to Web shows all the content but but Web2 the Publishing Service says it has published, but items are not being updated/showing if you go into the Sitecore Desktop Content Editor for Web2 unless CMS/CD Web Apps are restarted to rebuild from the database.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">>
<sitecore>
<eventing defaultProvider="sitecore">
<eventQueueProvider>
<eventQueue name="web2" patch:after="eventQueue[@name='web']" type="Sitecore.Data.Eventing.$(database)EventQueue, Sitecore.Kernel">
<param ref="dataApis/dataApi[@name='$(database)']" param1="$(name)" />
<param hint="" ref="PropertyStoreProvider/store[@name='$(name)']" />
</eventQueue>
</eventQueueProvider>
</eventing>
<PropertyStoreProvider>
<store name="web2" patch:after="store[@name='web']" prefix="web2" getValueWithoutPrefix="true" singleInstance="true" type="Sitecore.Data.Properties.$(database)PropertyStore, Sitecore.Kernel">
<param ref="dataApis/dataApi[@name='$(database)']" param1="$(name)" />
<param resolve="true" type="Sitecore.Abstractions.BaseEventManager, Sitecore.Kernel" />
<param resolve="true" type="Sitecore.Abstractions.BaseCacheManager, Sitecore.Kernel" />
</store>
</PropertyStoreProvider>
<databases>
<!-- web_secondary -->
<database id="web2" patch:after="database[@id='web']" singleInstance="true" type="Sitecore.Data.DefaultDatabase, Sitecore.Kernel">
<param desc="name">$(id)</param>
<icon>Images/database_web.png</icon>
<securityEnabled>true</securityEnabled>
<dataProviders hint="list:AddDataProvider">
<dataProvider type="Sitecore.Data.DataProviders.CompositeDataProvider, Sitecore.Kernel">
<param desc="readOnlyDataProviders" hint="list">
<protobufItems type="Sitecore.Data.DataProviders.ReadOnly.Protobuf.ProtobufDataProvider, Sitecore.Kernel">
<filePaths hint="list">
<filePath>$(dataFolder)/items/$(id)</filePath>
<modulesFilePath>/sitecore modules/items/$(id)</modulesFilePath>
</filePaths>
</protobufItems>
</param>
<param desc="headProvider">
<dataProvider ref="dataProviders/main" param1="$(id)">
<disableGroup>publishing</disableGroup>
<prefetch hint="raw:AddPrefetch">
<sc.include file="/App_Config/Prefetch/Common.config" />
<sc.include file="/App_Config/Prefetch/Webdb.config" />
</prefetch>
</dataProvider>
</param>
</dataProvider>
</dataProviders>
<PropertyStore ref="PropertyStoreProvider/store[@name='$(id)']" />
<remoteEvents.EventQueue>
<obj ref="eventing/eventQueueProvider/eventQueue[@name='$(id)']" />
</remoteEvents.EventQueue>
<archives hint="raw:AddArchive">
<archive name="archive" />
<archive name="recyclebin" />
</archives>
<cacheSizes hint="setting">
<data>100MB</data>
<items>50MB</items>
<paths>2500KB</paths>
<itempaths>50MB</itempaths>
<standardValues>2500KB</standardValues>
</cacheSizes>
</database>
</databases>
<sites>
<site name="website" set:database="web2" />
</sites>
</sitecore>
</configuration>