A workflow can be developed with following steps
Author Initiates workflow -> Replicates content to internal publish server. AEM provides ReplicationOptions API. This can help selecting the replication agent using public void setFilter(AgentFilter filter). Agent can be named as per requirement, regex can be used to match required agents as given in link reference. A workflow process can be created for this. The request would reside with approver (Using Participant Step). Approver can now verify the content on internal publish server.
Once approver approves content, on Approval another workflow process push the content to public publish server, here also we can use public void setFilter(AgentFilter filter)
If multiple pages/assets need to be published, Workflow Package feature can be used to bundle multiple pages/assets. This of-course needs adding the code in Workflow Processes created in step 1, 2 to publish pages/assets by iterating over payloads that are part of workflow package
Source :- http://stackoverflow.com/questions/35315967/cq-aem-staging-concept-with-workflows
You would have to implement several things to allow this work:
- You need replication agents for all the production publish servers and the staging servers. To simply your life you will probably want to set up your dispatcher agents on your publish and staging servers so you don't have to deal with them during the workflow.
- You need to decide how you want the standard activation tools to behave (activate button, activate later, other possible workflows) behave. You have a couple of options:
- Have the default activation behaviors publish to both environments
- Have the default activation only publish to production publish
- Have the default activation only publish to staging
- Have the default activation do nothing
- Based on that decision above you may have to check the Ignore Default option on the Triggers tab of the replication agents that shouldn't get anything on the standard publish.
- Create a workflow process that will publish only to selected publish instances. Most likely this will be a step that only publishes to your Staging server, in which case you need some configuration mechansim which identifies which replication agents are staging agents.
Source :- https://forums.adobe.com/thread/1255002
~kautuk