Sunday, 13 March 2016

Setting up an AEM Server from scratch - Part 2

Setting up of the Replication Agents

After you have setup the Author and Publish instances, you need to setup the Replication Agents.

Replication agents are central to Adobe Experience Manager (AEM) as the mechanism used to:

  • Publish (activate) content from an author to a publish environment.
  • Explicitly flush content from the Dispatcher cache.
  • Return user input (for example, form input) from the publish environment to the author environment (under control of the author environment).
  • Requests are queued to the appropriate agent for processing.

Replicating from Author to Publish

Replication, to a publish instance or dispatcher, takes place in several steps:

  • the author requests that certain content be published (activated); this can be initiated by a manual request, or by automatic triggers which have been preconfigured.
  • the request is passed to the appropriate default replication agent; an environment can have several default agents which will always be selected for such actions.
  • the replication agent "packages" the content and places it in the replication queue.
  • in the Websites tab the colored status indicator is set for the individual pages.
  • the content is lifted from the queue and transported to the publish environment using the configured protocol; usually this is HTTP.
  • a servlet in the publish environment receives the request and publishes the received content; the default servlet is http://localhost:4503/bin/receive?sling:authRequestLogin=1.
  • multiple author and publish environments can be configured.



Replicating from Publish to Author

Some features, such as commenting, allow users to enter data on a publish instance.

In some cases, a type of replication known as reverse replication, is needed to return this data to the author environment from where it is redistributed to other publish environments.  Due to security considerations, any traffic from the publish to the author environment must be strictly controlled.

Reverse replication uses an agent in the publish environment which references the author environment. This agent places the data into an outbox. This outbox is matched with replication listeners in the author environment. The listeners poll the outboxes to collect any data entered and then distribute it as necessary. This ensures that the author environment controls all traffic.

In other cases, such as for Communities features (for example, forums, blogs, comments, and reviews), the amount of user generated content (UGC) being entered in the publish environment is difficult to efficiently synchronize across AEM instances using replication.

Now, for the fun part, let us do the actual setting up for the agents:

  • Go to the following section on the author site: Tools.
  • On the left menu, find the Replication section and click on the word Replication.
  • You will see in the main pane all the replication agents that are currently set up.
  • Click on ‘New’ and then on ‘New Page’.
  • A modal will popup – it will look like the modal from the new page creation section.
  • Fill in the Title Field of the Replication agent and also the Name Field of the new replication agent.
  • Select the ‘Replication Agent’ selection below the name field and click on create.
  • You have now created a new replication agent, but you still need to set up the properties of the agent.
  • Double click on the agent and it will open up the properties section of the Replication agent.
  • Find the “Edit” button and click on that.

  • There will be a popup modal and you need to complete some of the fields. List below:

  • Name: This will be pre-populated, you can change this, but no need.
  • Description: Give your agent a proper description. (Whatever rock your boat)
  • Enabled: Tick the box, to enable the replication agent.
  • Serialization Type: From the dropdown, select ‘Default’.
  • Retry Delay: Make this 6000 (that is 6 seconds).
  • Log Level: From the dropdown, select Info.
  • On the next tab: Transportation, complete the following:
  • URI: must be the publish server’s and then: http://0.0.0.0:4505/bin/receive?sling:authRequestLogin=1
  • User: The user must be setup on the Author and Publish and have the correct credentials to activate assets.
  • Password: The User’s password.
  • Once this is all completed, click on OK.

  • You should see that the agent will now be active and you will be able to publish pages to the publish server. You can do a test to see if it works – but first you need to setup the sling mappings on the publish servers.
  • To test your connections, you can click on the link: Test Connection, this will open a new tab in your browser with some test results. If it is setup correctly, you will get a message saying: ‘Replication test succeeded.’
  • If you don’t get that message, the system will tell you where the issue is via a system message.


Below are a few images to illustrate the above explanation:

In the Tools Section, go to the Replication -> Agents on Author



Click on New -> New Page...


Choose a suitable name for you Agent (007 is not recommended!)





Once it is created, find you agent in the list on the right, and double click on it, you will see the same view as below.



We do need to configure the agent now. Click on the 'Edit' in the Settings bar.




After you have configured the agent, you need to test it and see if it does in fact connect to the publish server. Click on the Test Connection link to test.



Once you get the above image and the message ' Replication test succeeded', then you are on the money. If not, it will usually tell you in an error message where is the error. You can also review the logs.

Reverse replication from Publish to Author

Reverse replication is used to get user content generated on a publish instance back to an author instance. This is commonly used for features such as surveys and registration forms.

For security reasons, most network topologies do not allow connections from the "Demilitarized Zone" (DMZ) (a subnetwork that exposes the external services to an untrusted network such as the Internet).

As the publish environment is usually in the DMZ, to get content back to the author environment the connection must be initiated from the author instance. This is done with:
  • an outbox in the publish environment where the content is placed.
  • an agent (publish) in the author environment which periodically polls the outbox for new content.
A reverse replication agent in the author environment
This acts as the active component to collect information from the outbox in the publish environment:
If you want to use reverse replication then ensure that this agent is activated.



A reverse replication agent in the publish environment (an outbox)
This is the passive element as it acts as an "outbox". User input is placed here, from where it is collected by the agent in the author environment.



Ok, its time for some coffee.. when you are back, we will then setup the sling mappings on the publish server and also setup the Dispatcher Flush Agents.


See you in Part 3 :) 

No comments:

Post a Comment