To make this simple I've got EnvA which i make amends and deploy to EnvB using courier.
I've been using your EventsLogger to see if the ExtractedItemResources will be trigger, I've put in break points on all the events trigger including the ExtractedItemResources but I can't seems to get it trigger at all when I courier things across to EnvB.
The event definitely loads as it hits into ApplicationStarted when the site first loads, but can't get into it anymore after that with Courier deploy.
TheExtractedItem event has been fixed since I posted my code so that it now works. I get the GUID of the node with e.Item.ItemId.Id. One thing that was surprising for me is that this event happens on the sending environment (I guess all the processing happens there), so the receiving environment doesn't get the event triggered. I was expecting it to happen in the environment where it was extracted. It's a little unfortunate, but I've worked around this by calling an API on the receiving environment.
The API code I have is very specific to my project. I am updating Relations for specific content types.
But it's just an UmbracoApiController webmethod that takes a Guid as a parameter. I then get the node. Here's the code (removing the project specific stuff where I put the "do stuff with node" comment:
[HttpGet]
public void UpdateRelations(Guid guid)
{
try
{
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
var node = umbracoHelper.TypedContent(guid);
// do stuff with node
}
catch (Exception ex)
{
LogHelper.Error<MyApiController>("Error for guid " + guid.ToString(), ex);
throw ex;
}
}
I have everything in a try/catch block because if there is an error, it doesn't seem to log/output a useful message.
Also, forgot to mention this - not sure if it's really needed -- but I was worried about overloading the server by making a lot of API calls all at once when many nodes are transferred, so I actually queue the calls to the API using Azure Storage Queue and then have the queue call the server using Azure Functions. Not sure this is needed but I already had it in place for other things.
One other detail - I check the type to make sure it's a "Document" because I just want to the Document - I think the event also triggers for Property Data.
Courier (v 2.52.14) Notifier events not firing
I'm trying to fire a custom event when courier has finished publishing a node or all nodes sent.
I have added the following listener in ApplicationStarted
But the event is never triggered. I have ensured this code is being called on start up of both the sender and receiving sites.
Anyone able to point me in the right direction.
I'm having the same problem. I have code to log every ExtractionManagerEvents event, but only
ExtractedItemResources
seems to fire...My code is at https://github.com/alindgren/UmbracoCourier.EventsLogger
Hey Alex,
To make this simple I've got EnvA which i make amends and deploy to EnvB using courier.
I've been using your EventsLogger to see if the ExtractedItemResources will be trigger, I've put in break points on all the events trigger including the ExtractedItemResources but I can't seems to get it trigger at all when I courier things across to EnvB.
The event definitely loads as it hits into ApplicationStarted when the site first loads, but can't get into it anymore after that with Courier deploy.
Any idea?
Thanks
The
ExtractedItem
event has been fixed since I posted my code so that it now works. I get the GUID of the node withe.Item.ItemId.Id
. One thing that was surprising for me is that this event happens on the sending environment (I guess all the processing happens there), so the receiving environment doesn't get the event triggered. I was expecting it to happen in the environment where it was extracted. It's a little unfortunate, but I've worked around this by calling an API on the receiving environment.Aha so the event will only be triggered at the sending end but not the receiving end?
Will you be able to share the code that you used for the receiving environment (the API calling that you have?)
Thanks
The API code I have is very specific to my project. I am updating Relations for specific content types.
But it's just an UmbracoApiController webmethod that takes a Guid as a parameter. I then get the node. Here's the code (removing the project specific stuff where I put the "do stuff with node" comment:
I have everything in a try/catch block because if there is an error, it doesn't seem to log/output a useful message.
Ic. You are calling this API from within your Sending environment within the ExtractedItemResources events.
Eg your receiving site is Receiving.com
So, in your Sending environment ExtractedItemResources event, you are calling your Receiving.com/umbraco/api/UpdateRelations/?guid=xxxxxxxxxxxxxx
To trigger the update right?
I'm using the ExtractedItem event.
Also, forgot to mention this - not sure if it's really needed -- but I was worried about overloading the server by making a lot of API calls all at once when many nodes are transferred, so I actually queue the calls to the API using Azure Storage Queue and then have the queue call the server using Azure Functions. Not sure this is needed but I already had it in place for other things.
Here is my event handler code:
The
QueueNode
method just dumps the URL in the storage queue.One other detail - I check the type to make sure it's a "Document" because I just want to the Document - I think the event also triggers for Property Data.
Ic. Thanks Alex
Ic. Thanks Alex, I'll try it out. Helps a lot
is working on a reply...