Author Topic: Looking some help to read email from queue using interaction server protocol  (Read 479 times)

Offline Rajnish@49

  • Jr. Member
  • **
  • Posts: 58
  • Karma: -1
Hello All,

We are looking to read incoming active email in interaction queue. I am trying to use interaction server protocol to connect to IXN server which is working fine. But I am not sure how do i submit request to interaction server using keyValueCollection. ANy Help is much appreciated.


Thanks,
Rajnish

Offline Rajnish@49

  • Jr. Member
  • **
  • Posts: 58
  • Karma: -1
I found solution around this. Below are some steps which i followed:-

        //create interaction server connection protocol
        InteractionServerProtocol interactionServerProtocol =
                new InteractionServerProtocol(
                        new Endpoint(
                                new URI("tcp://<HostFQDN>:<PORT>")));



        interactionServerProtocol.setClientName("EntityListner");
        interactionServerProtocol.setClientType(InteractionClient.AgentApplication);
        interactionServerProtocol.setClientName("WDE-CCG_U<serName>");

        //Open connection with ixn server
        interactionServerProtocol.open();
        log.info("INteraction server connected");
       

        //Request Agent login
        RequestAgentLogin requestAgentLogin=RequestAgentLogin.create();
        requestAgentLogin.setPlaceId("PlaceId");
        requestAgentLogin.setAgentId("AgentEmployeeID");
        requestAgentLogin.setTenantId(101);

        //Response for request Agent login
        Message m1=interactionServerProtocol.request(requestAgentLogin,100000);
       


        //Request Take Snapshot
        RequestTakeSnapshot takeSnapshot=RequestTakeSnapshot.create();
        takeSnapshot.setCondition("MediaType='email' AND Queue='QueueName'");
        takeSnapshot.setSnapshotMaxInteractions(500);
        takeSnapshot.setCheckInteractionsState(false);
        takeSnapshot.setLock(false);


        //get response of Request Take snapshot
        Message respone=interactionServerProtocol.request(takeSnapshot,100000);
        EventSnapshotTaken snapshotTaken= (EventSnapshotTaken) respone;
        //log.info("snapshot ID="+snapshotTaken.getSnapshotId().toString());


        //Request Get snapshot interaction to get interactions
        RequestGetSnapshotInteractions requestTakeSnapshot=RequestGetSnapshotInteractions.create();
        requestTakeSnapshot.setSnapshotId(snapshotTaken.getSnapshotId());
        requestTakeSnapshot.setStartFrom(0);
        requestTakeSnapshot.setNumberOfInteractions(500);
        requestTakeSnapshot.setProxyClientId(snapshotTaken.getProxyClientId());


        Message m2=interactionServerProtocol.request(requestTakeSnapshot);


        EventSnapshotInteractions interactions= (EventSnapshotInteractions) m2;

        KeyValueCollection ixn=interactions.getInteractions();

        List<KeyValuePair> lst1=ixn.stream().toList();

        for(int i=0;i<lst1.size();i++)
        {
            KeyValuePair kv2=lst1.get(i);
            log.info("IxnId="+kv2.getStringKey());

        }

        interactionServerProtocol.close();

        log.info("Interaction server connection disposed");

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
What do you want to achieve? KeyValueCollection itself has nothing to do with IXN directly, KVC is just key-value pair collection which mostly represents interaction's userdata