Skip to main content

Posts

Custom Cache Invalidation using JMS

Let's say you have your own application or a custom cache that stores some Tridion items for better performance. You are not relying solely on the Tridion object cache, and you built your own cache layer on top of it. You don't want to serve stale content or use a dummy time-to-live cache, and you chose an elegant dependency cache implementation. This implies you need to intercept the cache 'invalidate' messages from the Tridion Deployer and use them to remove the updated items from your custom cache. This is exactly the setup I happen to have -- DD4T Java web-application using RESTful services providers. The DD4T application makes no use of Tridion APIs whatsoever, everything being abstracted in the services layer. The DD4T factories call the service-based providers and cache the returned models in a local EHCache. Naturally, I need an elegant cache notification mechanism to flush the items in the EHCache that are updated by a publish action. The Cache Channel Servic...

Setup Apache ActiveMQ

This is a follow up of my previous post JMS Cache Channel Setup . The goal is to configure JMS cache invalidation for Tridion Content Delivery. In my previous post I was describing how to configure the Tridion Deployer to use JMS technology and to post cache notification messages to an Apache ActiveMQ server. This post describes the steps I took to install and configure ActiveMQ on my machine. I started my endeavor without having any prior experience with ActiveMQ. To my surprise, the installation was a breeze and took me about 20 minutes to get everything running. I started by visiting the home of ActiveMQ -- activemq.apache.org . The latest version as of the day was 5.10.0. I followed the no-nonsense guide on the home page and I first downloaded ActiveMQ. I use a Mac (like every freelancer who respects himself :-p) and I personally love FreeBSD, so I downloaded the Unix/Linux/Cygwin Distribution . Namely, a file named apache-activemq-5.10.0-bin.tar.gz . The Getting Starte...

JMS Cache Channel Setup

In my current project, we are implementing the Tridion Cache Channel Service using JMS technology. Without having installed it previously I used to regard this as a little bit of voodoo. I started doing my due diligence research on the topic, only to find out that actually there are quite a few resources out there on JMS in general (doh!), as well as in conjunction with Tridion specifically. There are some great blog posts on JMS consumption and setup from Bruce Snyder: bsnyderblog.blogspot.com/2010/02/using-spring-to-receive-jms-messages bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in And a concise, but great post from Julian on enabling JMS for a Tridion Deployer: sdltridionworld.com/articles/usingsdltridionobjectcachingwithapacheactivemq A Bit of Architecture In a classic configuration (i.e. one using RMI), the Cache Channel Service (CCS) is running as a separate process, most likely a small stand-alone Java application. In a JMS configur...

Label Service in DD4T Java

Many times over we need to implement a Label service mechanism in our projects. This post shows one such approach for DD4T Java. The idea is to have a Labels Page published from Tridion containing the Labels Component on it. The labels are simply multi-valued Key - Value pairs represented by an Embedded Schema. The Labels page is read in DD4T and the labels on it are parsed and loaded into a java.util.Map. The front end code employs a custom JSP tag to read the label map and display the associated value for a given key. Content Manager Part We use Schema Label with a field ' label ' of type Embedded Schema, multi-valued. The Embedded Schema is ' Embedded label ' and contains two field, both single value text fields: ' key ' and ' value '. We create a Component ' Labels ' and populate it with our labels. This Component can be localized and translated in sub-Publications, as the Label Service can use context-aware Components to loa...

Experience Manager in DD4T with Service-Oriented Architecture Providers

This post describes the architecture for Tridion's Experience Manager (XPM) when used with an MVC framework such as DD4T in a Service-Oriented Architecture. This architecture implies that the website is completely independent of Tridion Content Delivery APIs. The only place where the CD APIs are used is on the Provider's Services Layer, as described in the following diagram. I am going to focus on this diagram to explain the basics of XPM and Session Preview mechanism in a DD4T with SOA providers setup. Publishing Flow This flow is a standard Content Delivery DB publishing flow: TRIDION CONTENT MANAGER publishes Pages, Components and Binaries to a DEPLOYER that writes everything in the CONTENT DELIVERY DATA STORE . It is very important to emphasize here that all  publishing types go to the CD DB and that nothing is written to a file-system. Content Delivery Flow This flow represents the normal delivery of pages and binaries from the web-application DD4...

OData Page Provider for DD4T Java

This little project has been on my mind for a while now: write a set of DD4T providers for OData (aka the Content Delivery Web Service). The approach is to remove all mentions of the CD API from the DD4T application itself and restrict Tridion interaction to the OData service. The DD4T application would use an OData client to talk with the service. Since communication with OData goes over HTTP, the number of queries to the service must be kept to a minimum, so the DD4T PageFactory will make heavy use of caching. I implemented an EHCache provider for DD4T, but that's not the scope of this blog post. So finally, this weekend I set on to writing these providers. The first challenge quickly showed up; the CD API is used in many DD4T classes and in the cases where the actual functionality is not used directly, DD4T still makes extensive use of CD API classes and interfaces. It took me a couple of hours to remove the mentions to com.tridion.* packages. During this process, t...

Retrieve Classified Items for Multiple Keywords

Using the standard Content Delivery API, it is possible to retrieve related content (i.e. items that are classified against Keywords) only for one Keyword at a time. If you find yourself with a requirement to read classified items for all  Keywords in a Taxonomy, then you'll quickly realize that approach is a performance killer. To better express what I'm looking for is the following: Keyword A -- classified with Component 1, Component 2     Keyword B -- classified with Component 3, Page 1     Keyword C -- classified with Component 1, Page 2 I want to read the classified items for all Keywords in a Taxonomy and still maintain the 'classified' relationship between each Keyword and its corresponding list of Components & Pages. The way I did it was to write my own Spring/Hibernate query and piggy-back on the existing DAO objects and methods available in the CD Storage API. The key is the bean  com.tridion.storage.RelatedKeyword , which basicall...