AGENTS:
(System-Queue; pr_ sys_queue; security tab; agent scheduler; queue for agent; )
1. What is an agent? What are the advantages of an agent?
It is internal processing requestor which is going to execute activities at scheduled time intervals. They are
introduced to perform the task without manual interaction on schedule basis.
There are two types of agents. They are Standard and advanced. Both will do the process without manual
interaction. Both agents have their own capabilities.
2. What are the differences between standard agent and advanced agent?
Advanced agent meant for processing like background task like bulk processing which are send email notification,
send SMS and upgrading the database records. It is one time task that can be performed on scheduled basis.
Standard agent going to do background tasks which are being queued. Its functionality is little different from
advanced agent. It is going to use an auto queue management processing. Whenever standard agent wakes up, it
is going to look up queue table pr_sys_queue. Standard agent is going to pick the items which have the status
scheduled. After the successful execution of an activity on work item or queue item, then queue item will be
removed from the queue table. If there is any failure in processing of the queue item, then the status of the queue
item will become “broken process” and queue item stays in the same queue. While processing, status is NOW
PROCESSING.
Standard agent will do the exception handling in itself. In case of advanced agent, if there is any failure, agent will
go down. And we need to find out the issue through the log files. You have to fix and you have to start the agent
manually. But in the standard agent, if there is any issue, items become into broken process. All these done by the
standard agent internally.
Agent will wake up by master agent SYSTEM PULSE at scheduled time.
Advanced agent standard agent
When agent wakeup, it directly execute agent activity. When agent wake up, it looks up class system-queue
and PR_SYS_QUEUE table, for an item which status is
scheduled.
Agent activity gets executed only once per wake up. Activity executes number of times based on the
Once activity executed, agent will go to sleep. number of work items in queue.
We need to write both business and transaction logic We are required to write the business logic only.
here. Process commander will take care of transaction logic.
These agents get stopped when the error or exception If an item processing fails, agent update the queue
occurs. item status as ”broken process”.
Agents get executed on the access group mentioned in Agent activity gets executed on the requestor access
the agent rule form. If we do not mention any access group who had kept the queue item in the queue
group, it will run guest access group “prpc:agents” table.
which is unauthenticated.
Recommended to run on a single node can run on multiple nodes. Agent on each node going
to pick a new queue item based the status. If you pick
item, the status scheduled changed to another.
Here it will execute an activity in only one time. It is going to pickup each item one by one at
processing. That number of times the activity will
execute.
3. How can you decide that agent will work on multiple nodes?
If we have 1 million work items available, if we run these through the advanced agent with single node it will
take much time. If you run the these in standard agent with multiple nodes, we can do the work in short time
than the advanced agent.
4. What is AQM? How it works?
5. What is the importance of access group in agent? If we do not give any access group what will happens?
We will give an activity in agent. Activity is a rule instance which associates with rule set version. When agent
executed, this agent has to pick this activity so that why we have to give the access group in security tab.
In advanced agent-If do not give access group, pega execute prpc:agents, which is unauthenticated access group
in standard agent- If do not give access group, pega will execute the requestors access group.
6. In advanced agent while items are processing, what happens if any work item is locked by an operator?
In advanced agent, it will through an error or exception
In the standard agent, if any operator opens the lock, the queue item status will become the “ broken process”.
It will pick the next item.
7. How can you trace the agent?
In the admin studio>resources>agents> select any agent>click on the tracer> (trace now, trace next run, trace next
earliest run)
Before that we have to run agent, first we have to run the activity and check and then check agent.
8. How can you debug the agent in production?
We cannot trace any rule in production. In production, we have to check in logs whether the agent will execute or
not. If agent through any error, we have to go to logs message and there you can see the error.
Navigation to the logs” configure>system>operation>logs>pega logs.
If you get any exception in the production, cannot open tracer, to debug this exception, we have to go to logs.
9. Why advanced agent configured on one node?
In this case, in advanced agent, we have to take care of transaction logic (to browse and open and save the work
object), exception will come when more than one agent process the single work object. That exception is locking
conflict. That’s why we run the advanced agent run on the single node.
This is not an issue in standard agent, because in the standard agent, if any work item is opened by any agent from
one node, immediately the status of that work item will change from schedule to In progress. So there is no
chance to agent to pick the same work item because the status of the work item is changed.
If the work item successfully processed in the standard agent, then that work item will remove from that queue.
If there is no work item, no agent can pick that work item. Due to these reasons, standard agent execute on
multiple nodes.
10. What happens if any item fails in the processing standard agent?
its status gets changed to “broken-process” and it will be there in the same table ”system-queue”
11. How to re-queue the items into the queue if any items failed in processing? How can we automate this Process?
In admin studio>resources>agent queues> here we can see fail items here. We have to select the item and click
on re queue option. Now the status of the work item is scheduled in place of broken process.
To automate this process, we can create an advanced agent which will run at schedule time and update the
broken items of “System-Queue-DefaultEntry” class to scheduled.
12. How to push the item into the queue?
By using the Queue For Agent OOTB activity. In this activity we have a method, queue-for-agent method, by using
this method we can push the item in queue manually.
Required parameters: agent rule set and agent name for both.
Agent name is for by using what agent you are pushing and what ruleset is assosiate with that agent.
13. What is the queue table? Where the items will be available?
Queue table contains queue items. In dev studio, we have a class “system-queue” which contain workitems. In the
backend table is (pr_sys_queues).
14. What is agent schedular? How to create it?
It is data instance. We cannot create it manally. When you create an agent, master agent system pulse create a
agent schedule for this agent.
For example, if you move the code to QA, there you want to make some changes like ti change the time, you need
not create new ruleset and you can go in agent schedular and you can make the changes. Agent and its activity
executes based on time mentioned on agent schedular than the agent.
In agent 30 sec: in agent schedular 60 sec: 60 sec will execute
15. Agent and agent schedular are instances of which class?
Agent is an instance of “Rule-Agent-queue”. Agent schedular is an instance of “Data-Agent-Queue”.
16. What is Bypass activity Authentication?
It is available in security tab in an Agent. It is check box.
If you select “require authentication” in security tab of an activity, It is nothing but locked with log in with
credentials. So if you want to use this activity from any external application, it will ask that authentication. If you
want stop that authentication, you have to select the “bypass activity authentication” in security tab in agent. This
option overrides the activities authentication.
17. What are job scheduler and queue processor?
Starting from the 8th version, pega introduced the job scheduler and queue processor.
Jod scheduler Queue processor
It is an alternative for advanced agent. Agent are It is an alternative for standard agent. Agent are
replicated on pega 8 onwards. deplicated on pega 8 onwards.
What is difference between the agents, queue processors and job schedulers?
Here will discuss about queue processor. Here we have kafka concept. Kafka is going to process the queue items as
messages. Where as standard agent is going to process the queue items like database records. Processing
messages is faster than the database table records.
The maximum number of thread that a queue processor can process 20 at a time where we can choose the option
in the queue processor itself.
For one single server, standard agent is going to process only work item. But queue processor is can process 20
queue items at a time parallel.
A job scheluler is configured to one email everyday at 7.00 am. But customer is getting the five emails instead of
one, he is getting four duplicate emails. What could be the reason and how to fix it?
The reason for this is the job scheduler might be run on five servers. We have to stop the job scheduler on
remaining four servers.
We have 10000 records in a table. Then how to process these records to create 10000 work objects. Each object is
taking one minute time. Overall it will take 10000 mins. How can do this in very less time?
This explanation might have worked on job schedulers. To reduce the time taking, we have to use the both queue
processor and job scheduler.
Let’s create a queue processor, which is going to process the 20 threads at a time on one server. And we
configure this queue processor in four different servers. At that time, it will process 80 items at a time. Which
means that in a minute 80 work objects can be created. Now we need to configure a job scheduler to pull all
10000 records from the table and instead of processing by job scheduler itself. Let’s take the first record and
queue it to queue processor and second record also. Now job scheduler only to do the task of picking the record
from the table and handing over it to queue processor and like this job get fetch 10000 records and give it to
queue processor and it will not create any work object.
Now queue processor receives all 10000 items and it going to start processing 20 work objects per server. Four
servers’ means 80 work objects. In a minute it will create 80 work objects. So that overall time will reduce. If you
increase the number of servers, automatically time will reduce.
We have an advanced agent which is deployed in multi node environment having four servers. While deploying
agents, it configured on Indian time 7.00 AM. Now four servers are different countries. India, Australia, Canada
and in USA. Agent is running in india time zone 7.00 am. But business is expecting that run on the server on its
respective times.
As the agent is created in india time zone 7 AM. We need to log on each server and open the schedule rule and
modify the time according their time intervels.