Author Message
rangari
Joined: Jun 18, 2015
Messages: 132
Offline
If you give me some documentation to use breeze eventing service then it will be very helpful.I just want to call my ed app from od.


Thanks for your help
rangari
Joined: Jun 18, 2015
Messages: 132
Offline
Or if you can provide some example code that will also helpful.
AnuragAggarwal
Joined: Jun 1, 2014
Messages: 154
Offline
something on lines of

// to get local machine security ip so that we can oublish to here, or skip this if you know breeze security ip otherwise
public String getSecurityIP() {
InetAddress myInterface = null;
AssetDM assetDM = (AssetDM) DMFactory.getInstance().getDataMgr(AssetDM.class);
if (assetDM != null) {
AssetLinkInfo localAsset = null;
localAsset = assetDM.getAssetLinkInfo(AsmConstants.TRANSPORT.TLS);
if (localAsset != null) {
try {
myInterface = InetAddress.getByName(localAsset.getEntityIp());
logger.fine("Asset DM IP: " + localAsset.getEntityIp());
return myInterface.getHostAddress();
} catch (UnknownHostException uhe) {
logger.error("UserTaskUtil: TLS, could not determine FQDN/IP address", uhe);
}
}
}
return null;
}


// actual publishing of event

import com.avaya.asm.datamgr.DMFactory;
import com.avaya.collaboration.call.Call;
import com.avaya.collaboration.call.CallFactory;
import com.avaya.collaboration.eventing.EventFilter;
import com.avaya.collaboration.eventing.EventSubscription;
import com.avaya.collaboration.eventing.EventSubscriptionAttributes;
import com.avaya.collaboration.eventing.EventingException;
import com.avaya.collaboration.eventing.EventingResultCode;
import com.avaya.collaboration.eventing.SubscriptionSelectionFilter;
import com.avaya.collaboration.eventing.internal.EventFamilyCallEac;
import com.avaya.workflow.env.CommonFactory;
import com.avaya.workflow.env.PlatformRestOpsFactory;
import com.avaya.workflow.eventing.EventDefinition;
import com.avaya.workflow.eventing.EventException;
import com.avaya.workflow.eventing.EventId;
import com.avaya.workflow.eventing.EventingErrorCode;
import com.avaya.workflow.eventing.EventingService;
import com.avaya.workflow.logger.Logger;
import com.avaya.workflow.logger.LoggerFactory;
import com.avaya.zephyr.platform.dao.EventCatalogDAO;

import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.json.JSONException;
import org.json.JSONObject;

import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.UUID;

public void publishEventWithAffinity(final String family, final String type, final String correlationId,
final String eventBody) {
URIBuilder uriBuilder = new URIBuilder().setPath(EVENTING_URL).setScheme(HTTPS).setPort(HTTPS_PORT);

uriBuilder.setHost(getSecurityIP());

try {
URI uri = uriBuilder.build();
logger.fine("Eventing connector URI:: " + uri);

HttpClient httpclient = createHttpClient();
HttpPost postRequest = new HttpPost(uri);
HttpEntity requestEntity = MultipartEntityBuilder.create().addTextBody("family", family)
.addTextBody("type", type).addTextBody("version", "1.0")
.addTextBody("eventBody", eventBody).addTextBody("metadata-correlationId", correlationId)
.build();
postRequest.setEntity(requestEntity);

HttpResponse response = httpclient.execute(postRequest);
logger.fine("Response from eventing connector: " + response);
} catch (Exception e) {
logger.error("Error publishing event: ", e);
}

}

public HttpClient createHttpClient() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext sslContext;
CloseableHttpClient httpClient;
try {
sslContext = SSLUtilityFactory.createSSLContext();

httpClient = HttpClients.custom().setSslcontext(sslContext)
.setHostnameVerifier(new AllowAllHostnameVerifier()).build();
} catch (SSLUtilityException e) {
logger.error("Error Creating SSL context ", e);
return null;
}

return httpClient;
}



rangari
Joined: Jun 18, 2015
Messages: 132
Offline
Thanks Anurag for providing code.

Is there any specific jar I need to import in my application. Becuase I am getting error when import that code that you provide. I am not sure which jar I need to add. Below is the classes giving error:
com.avaya.collaboration.
com.avaya.workflow
com.avaya.zephyr
com.avaya.asm

Also I am getting error in the following code:

sslContext = SSLUtilityFactory.createSSLContext();
httpClient = HttpClients.custom().setSslContext(sslContext)
.setHostnameVerifier(new AllowAllHostnameVerifier()).build();


Please suggest me on this.

Thanks again for your help.

RajeshChandrashekar
Joined: Oct 27, 2016
Messages: 60
Offline
Hi ,


  • For invoking a workflow from any external app, you can use the below link , which has a ppt on how to use the event catalog , use that event in your workflow and fire a REST to breeze to invoke the workflow.


  • https://www.devconnectprogram.com/forums/posts/list/20524.page



  • Also if you have breeze sdk with you , open the sdk and navigate to Avaya-Breeze-SDK\REST-API-Docs, open the ndex.html in browser which has details on how to fire an event to your breeze.



  • I believe OD application is not running on breeze server, so you need to know the breeze security/asset IP, create a HTTP client(this can be any generic http client ) on your OD and fire to breeze from your app.



    rangari
    Joined: Jun 18, 2015
    Messages: 132
    Offline
    Hi Rajesh,

    I have already tried the steps from PPT as well. But not able to invoke my ED application.
    In the code, I am getting Successful response code '200'.But my Engagement Designer workflows is not invoked. Below is the url which I used in Code as suggested in PPT:

    "https://Breeze server IP/services/EventingConnector/events"

    In the response I am getting some HTML code with below message:

    <div class="legalNoticeDivContent" style="width: 800; height: 650; overflow-y: scroll;">
    This system is restricted solely to authorized users for legitimate business purposes only. The actual or attempted unauthorized access, use, or modification of this system is strictly prohibited.
    <br>
    <br>Unauthorized users are subject to company disciplinary procedures and or criminal and civil penalties under state, federal, or other applicable domestic and foreign laws.
    <br>
    <br>The use of this system may be monitored and recorded for administrative and security reasons. Anyone accessing this system expressly consents to such monitoring and recording, and is advised that if it reveals possible evidence of criminal activity, the evidence of such activity may be provided to law enforcement officials.
    <br>
    <br>All users must comply with all corporate instructions regarding the protection of information assets.


    Please suggest me on this.

    Thanks
    RajeshChandrashekar
    Joined: Oct 27, 2016
    Messages: 60
    Offline
    Hi,
    could you please open browser and fire this url ?

    https://BreezeAssetIP/services/EventingConnector/events
    Breeze has two interfaces, mgmt IP and Asset(security) IP, so please use Asset IP in above url

    You should be getting 405 and not the below error mentioned by you, if you are getting a 405 then use the postman as described in the ppt and fire a request and see if the workflow is invoked.

    Thanks,
    Rajesh
    rangari
    Joined: Jun 18, 2015
    Messages: 132
    Offline
    Hi Rajesh,

    I have three Asset(security) IP. I tried all the IP's in below URL, it gives me 400 bad request error in browser:

    https://BreezeAssetIP/services/EventingConnector/events

    Thanks
    DhanujDM
    Joined: Dec 18, 2015
    Messages: 3
    Offline
    Can you please get output of this command from the Breeze node -
    deploy_service -lv


    Thanks,
    Dhanuj
    rangari
    Joined: Jun 18, 2015
    Messages: 132
    Offline
    Where I need to run this command. Can you give me the full information to run this command.
    DhanujDM
    Joined: Dec 18, 2015
    Messages: 3
    Offline
    Run this on linux bash console of Breeze node
    rangari
    Joined: Jun 18, 2015
    Messages: 132
    Offline
    I think,Right now i don't have permission to access console of breeze node. It is accessible through putty right?

    I will let you know my results when i am able to connect breeze node.


    Thanks Dhanuj for your help
    Go to:   
    Mobile view