Author Topic: How can I read agent and application configuration in WDE/IWS?  (Read 9573 times)

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
I am writing a WDE extension. I have been told that I can access the application and agent configuration via the config manager (container.Resolve<IConfigManager>), but the config manager's interface is far from friendly.

Could someone please show me an example of how to get the contents of a configuration section?

Thank you in advance.

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #1 on: March 31, 2016, 01:26:40 PM »
IConfigManager cfgMgr = container.Resolve<IConfigManager>;
cfgMgr.GetValue("name of the option on WDE object");

Do not know what is not friendly on that..

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #2 on: March 31, 2016, 01:32:51 PM »
I would like to get the contents of an arbitrary section. Does IConfigManager only return the options of the interaction-workspace section? And is there any way to get the agent's configuration?

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #3 on: March 31, 2016, 01:36:52 PM »
There is probably an interface in the IWS API that allows you to get the agent information, but I am not familiar with it off the top of my head.  Search through the included .chm help file for *Manager* and see if you come up with anything.

If all else fails you can use PSDK from your WDE extension, CfgPersonQuery is what you would want to look up in the PSDK documentation.

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #4 on: March 31, 2016, 02:55:23 PM »
Perhaps there is a way to access the ConfServerProtocol?

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #5 on: March 31, 2016, 03:14:49 PM »
There is, perhaps through IAgent / IAgentManager (I forget the name of the interface and dont have the .chm files installed right now).

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #6 on: April 01, 2016, 10:47:48 AM »
You can try to read some configuration directly by IAgent.

Try with IConfigurationService.

Regards.

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #7 on: April 05, 2016, 03:17:46 PM »
Thanks, daniel_san, that looks promising. However, I'm still having some problems.

I have done the following.

[code]IConfigurationService = container.Resolve<IConfigurationService>
RequestReadObjects requestReadObjects =
                RequestReadObjects.Create(
                    (int)CfgObjectType.CFGApplication,
                    filterKey);
configurationService.ConfigServerProtocol.Request(requestReadObjects);[/code]

I have an Event Broker to handle the EventObjectsRead, which I know is deprecated but I still don't know a better way to do it, and in any case that worked when I created my own connection to the Config Server, but now...

This simply doesn't work. WDE gets stuck in some infinite loop and no log is produced.

Does anyone have any idea what I did wrong, and what should be done instead? Is it possible that the ConfigServerProtocol was not yet initialized or something?

Thanks in advance.
« Last Edit: April 05, 2016, 03:21:16 PM by Gabi »

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #8 on: April 05, 2016, 03:34:37 PM »
On CfgServer logs do you see your request?

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #9 on: April 05, 2016, 05:36:37 PM »
[quote author=Gabi link=topic=9465.msg42957#msg42957 date=1459869466]
Thanks, daniel_san, that looks promising. However, I'm still having some problems.

I have done the following.

[code]IConfigurationService = container.Resolve<IConfigurationService>
RequestReadObjects requestReadObjects =
                RequestReadObjects.Create(
                    (int)CfgObjectType.CFGApplication,
                    filterKey);
configurationService.ConfigServerProtocol.Request(requestReadObjects);[/code]

I have an Event Broker to handle the EventObjectsRead, which I know is deprecated but I still don't know a better way to do it, and in any case that worked when I created my own connection to the Config Server, but now...

This simply doesn't work. WDE gets stuck in some infinite loop and no log is produced.

Does anyone have any idea what I did wrong, and what should be done instead? Is it possible that the ConfigServerProtocol was not yet initialized or something?

Thanks in advance.
[/quote]

Which application(s) are you trying to get and which information do you need from them?

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #10 on: April 11, 2016, 03:03:36 PM »
[quote author=PeteHoyle link=topic=9465.msg42959#msg42959 date=1459877797]
Which application(s) are you trying to get and which information do you need from them?
[/quote]I'm trying to access the WDE application and get the [b]whole[/b] configuration, not just the interaction-workspace section.

I will - eventually - need information about the current agent, agent groups and campaigns too.

I'm afraid I don't know much about reading config server logs, but here's the log of the last 2 minutes (I closed WDE right after I failed to read the configuration):

http://pastebin.com/4CSyqrN3

I think the request on line 1641 may be mine, but it may also be the one WDE does on its own when it starts.
« Last Edit: April 11, 2016, 03:07:09 PM by Gabi »

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #11 on: April 11, 2016, 04:36:55 PM »
Nevermind, it worked. I wasn't processing the result of the request correctly.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #12 on: April 11, 2016, 06:56:43 PM »
;D Congrats! just a suggestion, try to test always with another app which is not the one on PRD, on CME you just clone the Application you are using on PRD and use that for your tests. Easier to debug ;)

Can you please share your solution code here for reference?
Thanks and good luck!

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #13 on: April 12, 2016, 08:22:14 AM »
[quote author=Gabi link=topic=9465.msg42991#msg42991 date=1460392615]
Nevermind, it worked. I wasn't processing the result of the request correctly.
[/quote]

Looks like you got it working, another method is like this:

IConfigurationService configService = container.Resolve<IConfigurationService>();
KeyValueCollection options =  configService.MyApplication.Options;

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: How can I read agent and application configuration in WDE/IWS?
« Reply #14 on: April 21, 2016, 12:54:48 PM »
[quote author=PeteHoyle link=topic=9465.msg42993#msg42993 date=1460449334]
[quote author=Gabi link=topic=9465.msg42991#msg42991 date=1460392615]
Nevermind, it worked. I wasn't processing the result of the request correctly.
[/quote]

Looks like you got it working, another method is like this:

IConfigurationService configService = container.Resolve<IConfigurationService>();
KeyValueCollection options =  configService.MyApplication.Options;
[/quote]Thanks! I've already done what I needed, but knowing about this is bound to prove useful someday.