Question
CBA INDIA PVT LTD
IN
Last activity: 3 Oct 2019 1:57 EDT
How to Capture listener details at run time?
Hi,
we have 20 email listeners and these are monitoring on 20 different email boxes. We are using these 20 listeners for Auto case creation. we have same requestor ID for 5 email listeners.
my requirement is , I need to display the listener name and Email account for every case.
Question, how can we capture the listener and Email account(which are used for auto case creation) details at run time?
Please let me know if any other details requires..
Thanks,
Sravan
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi,
Please check PDC, you will get some details about listeners. What all details you want to capture.
Thanks,
Kranthi
CBA INDIA PVT LTD
IN
Hi,
As per my knowledge, PDC is all about monitoring the application performance and diagnose system health issues.
But i need to capture listener details and email account details at run time.
I need to display the listener name and Email account username at every case level.
PDC will give the details about application performance and diagnose system health issues, i don't need those details.
Thanks,
Sravan
Pegasystems Inc.
IN
Its bit long process since I don't know the name of property which will hold the value.
But you can always trace the agent and see the property values which are present just before CreateWorkEmail activity or any of your custom activity is called. Then you can use the property value in while creating the WO.
Hope this helps in moving forward
Pegasystems Inc.
US
The two properties below would help?
<pyAccountName>IntSampleService</pyAccountName>
<pyListenerName>IntSampleEmailListener</pyListenerName>
CBA INDIA PVT LTD
IN
Hi,
Thanks for giving advice. But i can not able to find the listener details.
as of now i am tracing the email listener and i could not able to capture the details.
Can you please tell me , in which activity i can capture the listener and email account name.
and when i have to trace the activity.
Thanks
Sravan
Pegasystems Inc.
IN
Hi Sravan,
Thanks for posting the query. PFB information which might be helpful to get the email listener at run-time.
Create a function with paremeters LogAttribute and ListenerAttribute and put this code, from your service activity call this function with param value (Stack,ListenerName) . function will give you the listener name
String attrValue= "";
boolean isStack = false;
if(!(LogAttribute.equals("pegathread") || LogAttribute.equals("app") || LogAttribute.equals("stack") || LogAttribute.equals("userid")))
{
attrValue = "Fail:LogAttribute is empty or invalid";
}
if(LogAttribute.equals("stack"))
{
isStack = true;
if(!(ListenerAttribute.equals("ListenerName") || ListenerAttribute.equals("EmailServer") || ListenerAttribute.equals("Sender")))
{
attrValue = "Fail:ListenerAttribute is empty or invalid";
}
}
try
{
Class listenerClass = Class.forName("com.pega.pegarules.priv.LogContext");
if(listenerClass!=null)
{
Hi Sravan,
Thanks for posting the query. PFB information which might be helpful to get the email listener at run-time.
Create a function with paremeters LogAttribute and ListenerAttribute and put this code, from your service activity call this function with param value (Stack,ListenerName) . function will give you the listener name
String attrValue= "";
boolean isStack = false;
if(!(LogAttribute.equals("pegathread") || LogAttribute.equals("app") || LogAttribute.equals("stack") || LogAttribute.equals("userid")))
{
attrValue = "Fail:LogAttribute is empty or invalid";
}
if(LogAttribute.equals("stack"))
{
isStack = true;
if(!(ListenerAttribute.equals("ListenerName") || ListenerAttribute.equals("EmailServer") || ListenerAttribute.equals("Sender")))
{
attrValue = "Fail:ListenerAttribute is empty or invalid";
}
}
try
{
Class listenerClass = Class.forName("com.pega.pegarules.priv.LogContext");
if(listenerClass!=null)
{
Class methodArgs[] = {String.class};
Object attr[] = {LogAttribute};
java.lang.reflect.Method listenerMethod = listenerClass.getMethod("get",methodArgs);
String attrStr = (String)listenerMethod.invoke(null,attr);
if(isStack)
{
int stackIndex = attrStr.indexOf('|');
String listenerStack = attrStr.substring(0,stackIndex);
String listenerArr[] = listenerStack.split("\\.");
if("ListenerName".equals(ListenerAttribute))
{
attrValue = listenerArr[1];
}
else
{
attrValue = listenerArr[2];
}
}
else
{
attrValue = attrStr;
}
}
}
catch(Exception e)
{
oLog.error("Exception while seeking GetEmailListenerName:"+e);
}
return attrValue;
CBA INDIA PVT LTD
IN
I have already tried above approach.
I have created one function with parameters as LogAttribute and ListenerAttribute .I am passing the "Stack" for LogAttribute and "ListenerName" for ListenerAttribute from service email activity.
But it is not returning any emaillistener name.
Please correct me if i am wrong.
Thanks,
Sravan