Workflow LockProcess AEM - Not locking the asset/page - java

I have a custom workflow for which the first step is default AEM "LockProcess". But somehow the asset/page not getting locked.
I have initiated the workflow as an admin and I'm using AEM 6.2
27.07.2017 13:16:09.994 *INFO* [JobHandler:
/etc/workflow/instances/server0/2017-07-25/workflow_name:/content/project/en-
us/test-general] com.day.cq.workflow.impl.process.LockProcess Locking is not
currently enabled. This is a No-Op
The same happens for "UnlockProcess".
Am I missing something here?
Thanks!!

You can enable locking of the payload in the "Day CQ Workflow Service" configuration.

Based on comments from Adobe Forum, I found there is a property
cq.workflow.service.allow.locking that should be enabled in CQWorkflowService.
Unfortunately, I could not find CQWorkflowService in http://localhost:4502/system/console/configMgr.
Digging further I found this website Missing Service that list all missing the hyperlinks for factory service and components of AEM 6.2.
Finally, I was able to initiate the default Lockprocess.

Related

(GAE-Standard+Java11) Sessions with multiple instances running

I have deployed my spring boot application on GAE, Java 11, Standard Environment. As per the documentation for Java11 we need to use app.yaml for configuring the instances.
I wanted to know as to how I can enable sharing of sessions between instances. As per my research, Earlier we could simply solve this problem by setting sessions-enabled and async-session-persistence in appengine-web.xml. With appengine-web.xml gone, what is the equivalent way of doing this in app.yaml.
Use case that i am trying to achieve is :
Using spring security (Unfortunately i get logged out when according to me the request of the same user goes to another instance.)
Storing the user retrieved from DB in a #SessionScoped variable so as to avoid multiple DB calls.
Any help here would be really appreciated. Thanks!
I went through a lot of documentation, but I believe that this is not inside the app.yaml configuration reference.
Alternatively, I could find that you could use session affinity in order to use a instance to reply always the requests of a same user, this can be enabled in your app you can use the next tag in your app.yaml according to this documentation.
network:
session_affinity: true
Hope this works for you.

Publish/Unpublish Adobe AEM page from Java

We have background process that automatically creates AEM pages as well as deletes old AEM pages. For pages to appear/disappear on the published site, they need to be activated (Published) / deactivated (Unpublished).
However, after searching from Google, I am not able to find AEM Java API that can publish/unpublish pages automatically.
Where can I find information on how to do this?
what you are looking for is the Replicator api. ReplicationActionType decides if you want to activate or deactivate.
replicator.replicate(session, ReplicationActionType.ACTIVATE,path);
replicator.replicate(session,ReplicationActionType.DEACTIVATE,path);
You can obtain Replicator instance using the #Reference annotation inside your OSGI service.
#Reference
Replicator replicator;
Have you thought about running the same background process on the publisher instead of activating/deactivating the pages?
I mean in case for some reasons your process fails during activation/deactivation you need to handle it and make sure that your publishers are still in a consistent state.
https://aem.redquark.org/2018/10/day-19-replication-api-in-action.html
Please refer this reference looks to be good and moreover if you want to deactivate you can use
replicator.replicate(session, ReplicationActionType.DEACTIVATE, path);
log.info("Replicated:---- {}", path);

Inspektr and its usage

I was going through details of CAS project and found that it is using something called inspektr. I googled for some time and tried to find more details about its usage. But I did not get any information.
Can anyone provide more details about it and its usage.
Thanks in advance.
Inspektr can be found here: https://github.com/dima767/inspektr with details for usage here: https://github.com/dima767/inspektr/wiki/Inspektr-Auditing
As I understand the project, it collects information from your web flow and allows you to save said data through the use of the #Audit annotations provided. If the configuration is copied from that CAS project you linked, nearly everything's configured to log to a file. Sample data logged would be the Client's IP, remote IP, the action being performed (as configured via Spring and the #Audit annotation), as well as various other things.
If you're familiar with Spring Aspects, it should be a breeze to look through the Inspektr source code to find other uses.
Inspektr is a framework that allows us to drive audit records from Annotations utilizing an Aspect that is provided with the framework. This works for Spring Managed Beans only!
Here the github project website:
https://github.com/dima767/inspektr/wiki/Inspektr-Auditing
A good practical reference for config: https://wiki.jasig.org/display/CASUM/Auditing+and+Statistics+Via+Inspektr
The base principal here is that Inspektr allows for logging of these audit frames into the console, database, the application server log ,we can even define our own managers to log to a different medium if required.

NCSA request handler doesn't work in pax-web 1.1.4

I try to enable NCSA request logging in pax-web 1.1.4. The recommended way to do it doesn't work. The file was created but it stays empty. Looking in source code I found that pax web implementation of Jetty server passes requests to JettyServerHandlerCollection which assumes that every handler should correspond a context. So it looks impossible for me just to use org.ops4j.pax.web.log.ncsa.* options.
Am I missing something or this functionality doesn't work in pax web? Are there any workarounds?
Yep, it's a bug in Pax-Web and has been filed on PAXWEB-416

debugging in struts application

i'm new to struts... I have a struts form. i need to analyze the data posted to an action class. i just want to output the data to a page and stop further execution so as to test of it is working correctly... how is it done..?
There are many ways to debug a struts application:
Configuration Plugin: You can use configuration plugin provided by struts. To use this plugin include struts2-config-browser-plugin-x.x.x.x.jar jar in your classpath and then you can use
">Launch the configuration browser
anywhere in your application to view a lot of detail about the action class.
The second way is to use Debugging Interceptor by using property debug=true in struts.xml.
See the below link for more details:
http://struts.apache.org/release/2.2.x/docs/debugging-struts.html
The easiest way to quickly and thoroughly inspect http requests and responses and post data is to use either:
http-fox with firefox (download)
chromes' network inspector (pre-installed with chrome - ctrl-shift-i - Network - Click on the appropriate post request and the body of the post will be displayed)
If neither of these very easy tools appeal, you'll have to find the appropriate hook to attach your debugger. I've not used struts since 2002 so cann't advise.
The best method is to use System.out.print and get the result in the tomcat console... i had said i need on server side not client side.

Categories