Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM 6.1 : ClientContext Vs Context hub

Jitendra_S_Toma
Level 9
Level 9

Hi All,

I have one simple question: 

As per the document, Context hub is: The ContextHub Javascript API provides access to the context data that ContextHub manages. This page briefly describes the main features of the API for accessing and manipulating context data. Follow links to the API reference documentation to see detailed information and code examples. 

In order to use context hub, we should have a piece of code in the head section.

    
<head>
   <sling:include path="contexthub" resourceType="granite/contexthub/components/contexthub" />
</head>

And, To get clientContext, there is something else to be included. What is the real purpose of these two?. '

Jitendra

1 Accepted Solution
kautuk_sahni
Correct answer by
Community Manager
Community Manager

Hi

Context hub is a replacement for client context it is better and more lightweight or ClientContext is basically the old version, ContextHub its replacement..

Client context had performance problems, it forces integration to wait on stores.init.js, ajax call, which slows stuff down a lot (esp site catalyst page-view calls). Context hub is a lot faster and fixes that.
Engineering team is avoiding changes to client context. Future is context hub.

In 6.1, the feature set of ClientContext was still higher than ContextHub, which itself relied on some ClientContext core functionalities to work.

With 6.2, we should have closed the gap, and we're currently working with Product Management to get the ClientContext deprecated in favor of the ContextHub.

I guess it would be a good idea to highlight some of the major architectural changes to clarify why ContextHub soon replaces ClientContextt:

  • ContextHub decouples the Kernel from the UI leading to a much lower footprint on publish 
  • ContextHub Stores can deal with complex hierarchical objects while ClientContext was limited to key-value pairs
  • The eventing model of ContextHub is a lot more sophisticated including the fact that eventing happens as soon as stores are available and not just after „all“ stores have been loaded
  • Loading behavior can be controlled on a fine grained level (sequence of loading & synchronous as well as asynchronous store loading)

All in all ContextHub is capable of every aspect ClientContext could deal with and is optimized in the most significant areas of clientcontext that turned out not to work perfect due to the architecture. 

IOW: go for ContextHub and create issues in case you find bugs or limitations that we are not aware of yet.

 

I hope this answers to you question.

Thanks and Regards

Kautuk Sahni

View solution in original post

8 Replies
kunal23
Level 10
Level 10

Couldn't find any good documentation which explains whats the difference between the two. But found the following text from the release notes - 

CONTENT TARGETING & SIMULATION

  • Introduced in 6.0 as Preview Technology, the Context Hub - the next generation Client Context - that is slimmer (less JS to load), faster (fires as the pages renders and loads stores lazy), more configurable (JSON) will allow you to simulate the site and personalization. Note that Context Hub has a compatibility mode - that you see in action in Geometrixx Outdoors - that loads the Client Context client-side part to execute the rules and allow all components and integration that are not yet adapted to work.
    • ContextHub: Next generation client-side rules engine and segment store (CQ-32346, CQ-32762, GRANITE-7551)
    • ContextHub: Enable editing of values for simulation (GRANITE-7681)
  • Improved UI to configure ContextHub under /etc/cloudsettings.html
  • Client-side Rules: Fixed an issue were collected tags by the visitor were not evaluated correctly: Cloud Condition (CQ-29881)
  • Client-side Rules: Fixed a regression that profile properties were not evaluated correctly (CQ-40836)
  • Fixed an issue that deleting an offer in the Content Targeting UI did not remove the offer from publish servers (CQ-14979)
Jitendra_S_Toma
Level 9
Level 9

Thanks Kunal. Will explore more on this.

Jitendra

kautuk_sahni
Correct answer by
Community Manager
Community Manager

Hi

Context hub is a replacement for client context it is better and more lightweight or ClientContext is basically the old version, ContextHub its replacement..

Client context had performance problems, it forces integration to wait on stores.init.js, ajax call, which slows stuff down a lot (esp site catalyst page-view calls). Context hub is a lot faster and fixes that.
Engineering team is avoiding changes to client context. Future is context hub.

In 6.1, the feature set of ClientContext was still higher than ContextHub, which itself relied on some ClientContext core functionalities to work.

With 6.2, we should have closed the gap, and we're currently working with Product Management to get the ClientContext deprecated in favor of the ContextHub.

I guess it would be a good idea to highlight some of the major architectural changes to clarify why ContextHub soon replaces ClientContextt:

  • ContextHub decouples the Kernel from the UI leading to a much lower footprint on publish 
  • ContextHub Stores can deal with complex hierarchical objects while ClientContext was limited to key-value pairs
  • The eventing model of ContextHub is a lot more sophisticated including the fact that eventing happens as soon as stores are available and not just after „all“ stores have been loaded
  • Loading behavior can be controlled on a fine grained level (sequence of loading & synchronous as well as asynchronous store loading)

All in all ContextHub is capable of every aspect ClientContext could deal with and is optimized in the most significant areas of clientcontext that turned out not to work perfect due to the architecture. 

IOW: go for ContextHub and create issues in case you find bugs or limitations that we are not aware of yet.

 

I hope this answers to you question.

Thanks and Regards

Kautuk Sahni

View solution in original post

konradw58070066
Level 2
Level 2

I found the following two limitations in AEM 6.1 SP1 of the ContextHub:

  1. The target integration does not leverage the SegmentManager from the ContextHub, therefore you cannot directly rely on ContextHub segments for targeting (this is fixed in the upcoming AEM 6.2)
  2. There is no UI for the Segment Editor, therefore opening http://localhost:4502/etc/segmentation/contexthub/female.html is exposing a blank page (this is not even fixed in the latest AEM 6.2 beta load20)

Can someone quickly comment on those?

Jitendra_S_Toma
Level 9
Level 9

@KonradWindszus,

This is a bug in AEM 6.1 and they have fixed in aem 6.2. You can take hotfix for this.

MaxBarrass
Level 3
Level 3

This works in 6.2, here is what that URL looks like

MaxBarrass
Level 3
Level 3

This works in 6.2, here is what that URL looks like