ClientContext to ContextHub migration guide

Avatar

Avatar
Validate 10
Level 4
sandeepk7656774
Level 4

Likes

21 likes

Total Posts

64 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 4
sandeepk7656774
Level 4

Likes

21 likes

Total Posts

64 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
sandeepk7656774
Level 4

04-07-2017

Hi All,

ClientContext is being deprecated for ContexHub. If you have experience of using both, please see if you can help with following information

  1. Comparison between the two - We don't see anything in official documentation.
  2. Migration/Upgrade information from ClientContext to ContextHub - Current application is using clientcontext for personalization (Campaigns, Teasers, Segments).  Is there a migration guide which can help application use ContextHub (Similar to the way upgrade for AEM versions has).

Any additional information, experiences around clientcontext, contexthub would also be helpful.

Thank you

Sandeep

Replies

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

05-07-2017

Replying to First part of the question:

1. Caparison between 2:- AEM 6.1 : ClientContext Vs Context hub

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.

~kautuk

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,200 likes

Total Posts

6,394 posts

Correct reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

05-07-2017

tc82 jainatish bsloki Opkar Gill any help here?

~kautuk

Avatar

Avatar
Validate 10
Level 3
tc82
Level 3

Likes

21 likes

Total Posts

64 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
tc82
Level 3

Likes

21 likes

Total Posts

64 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
tc82
Level 3

06-07-2017

I have created the document , will upload it here for the migration guide.

Also let me know you need the package.

Avatar

Avatar
Validate 10
Level 4
sandeepk7656774
Level 4

Likes

21 likes

Total Posts

64 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 4
sandeepk7656774
Level 4

Likes

21 likes

Total Posts

64 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
sandeepk7656774
Level 4

06-07-2017

Thank you kautuksahni and tc82. The package and document would be helpful.

Avatar

Avatar
Validate 10
Level 4
sandeepk7656774
Level 4

Likes

21 likes

Total Posts

64 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 4
sandeepk7656774
Level 4

Likes

21 likes

Total Posts

64 posts

Correct reply

4 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
sandeepk7656774
Level 4

13-07-2017

tc82  - Gentle reminder, if you could share the document, package you were talking about.

Avatar

Avatar
Validate 10
Level 3
tc82
Level 3

Likes

21 likes

Total Posts

64 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
tc82
Level 3

Likes

21 likes

Total Posts

64 posts

Correct reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
tc82
Level 3

14-07-2017

ContextHub Implementation

· Table of contents

    • Introduction to ContextHub
    • Files to be changes to replace CleintContext with ContextHub

 

Introduction to ContextHub:

  • Name  the folder as: contexthub
  • Create a folder undern contexthub called modules
  • Create a folder undern modules called commerce
  • Create a folder undern commerce called clientlib
  • Create a file under clientlib named as .content.xml
  • Code for the .content.xml

  style="padding-left:45px"

  • Add the following line inside the css.txt
    renderer.commerce.css
  • Create a file under clientlib named as js.txt
  • Add the following line inside the js.txt
    renderer.commerce.js
  • Create a file under clientlib named as  renderer.commerce.css
  • Add the following line inside the renderer.commerce.css

  style="padding-left:45px"

  • Create a folder under above path named: stores
  • Create a folder under stores named: commerce
  • Create a folder under commerce named: clientlib
  • Create a file under clientlib called .content.xml
  • Add the following code in the .content.xml

  style="padding-left:45px"

  • Add the following code:
    store.commerce.js 
  • Create a new file under clientlib called store.commerce.js
  • Add the followig code:

  style="padding-left:45px"

  • Create a folder named customclientcontextlibs
  • Create a file .content.xml under customclientcontextlibs folder.
    Add the following code:

  style="padding-left:45px"

function callingSatellitePageBottom(){
if (window.ContextHub) {
ContextHub.eventing.on(ContextHub.Constants.EVENT_INITIALIZED + ":XXXX", function(event, data) {
_satellite.pageBottom();
});
}
}

  1. Including the CSS and ContextHUb:

<cq:includeClientLib css="cardinalhealth.oe.customclientcontextlibs" />

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

  1. Get the COntextHUb Data:

//ContextHub tree details command:
var data = ContextHub.getStore('XXXX').getTree();

I have attached the zip of files modified from my local.

Note: XXXX is the store name

am not able to attache the package.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

14-07-2017