Utilizing the URL agent for Sitecore – AND PUPPIES!

I recently asked for blog topics via Twitter (@fozapd) and Jason Wilkerson responded with “Puppies!”, so to appease Jason I decided to write a lovely blog post about utilizing URL agents to help you manage
your puppy responsibilities. While one can always manually accomplish tasks via Sitecore, a lot of the time you don’t want the manual responsibility of executing a task especially when it occurs multiple times a day. For those cases, utilizing the URL agent and automating it to run on a schedule may make sense. The UrlAgent (Sitecore.Tasks.UrlAgent) is a simple Sitecore agent which accesses a predefined URL at regular intervals.

Example: Jason recently got a new puppy because he screamed loud enough on social media. However, Jason didn’t realize how much work a new puppy could be and it started to interfere with his Sitecore work. The new puppy needed to be fed 3x a day. The new puppy also needed to be walked every 4 hours.  Being a master of IoT, Jason rigged his house to open a doggie door via a URL on his doggy cam Sitecore website. Jason also added the capability for dog food to be dispensed via a URL on the same Sitecore website. NOTE: Ever since writing his book, Jason can afford frivolous Sitecore license purchases.


Easy Configuration:
  • Type: The class to use. In this case: Sitecore.Tasks.UrlAgent
  • Method: The method to execute. In this case: Run
  • Interval: Frequency to execute agent. 


  <agent interval="08:00:00" method="Run" type="Sitecore.Tasks.UrlAgent">
    <param desc="url" />http://jasonlovespuppies.com/scheduledtasks/FeedPuppy<param />
    <logactivity>true</logactivity>
  </agent>
  <agent interval="04:00:00" method="Run" type="Sitecore.Tasks.UrlAgent">
    <param desc="url" />http://jasonlovespuppies.com/scheduledtasks/WalkPuppy 
    <logactivity>true</logactivity>
  </agent>


The URLs just point to a page within your Sitecore instance that fires off the desired logic. Now every 8 hours Jason’s puppy will be fed and every 4 hours Jason’s puppy will be allowed outside. This allows Jason to keep his Sitecore clients happy and maybe present to a few user groups with all the free time he has.

Real world examples:
  •  Reloading web service data
  •  Sending nightly notifications
  •  Syncing with another 3rd party system

Comments

  1. How did you even get a sitecore license fil. I'm trying to learn it but find it impossible since they dont even provide a trial license !

    ReplyDelete

Post a Comment