Forum Post: Java Open Client communication with OpenEdge Application Server

Status
Not open for further replies.
D

Dshebeko

Guest
Hi everyone!:) I've tried to find out how Java Open Client communicates with OpenEdge AppServer and eventually joined your community. The problem is I'm not sure whether my Java programm works in correct way. I mean I have some doubts in piece of code which responsible for Java-OpenEdge communication. I have OpenEdge Application Server running on State-free mode. My java client is just a SOAP web-service web-application, which is deployed on Tomcat. Soap web-service server receives SOAP http requests from external systems and fires Progress procedure call on AppServer using AppObject, generated by ProxyGen Tool. I need to call the only progress non-persistent procedure named i-uek-all.p, so my proxy AppObject class (which in turn is called OpenEdgeProxy) also has just one method: iUekAll. Here is Java service class, which makes requests to OpenEdge Application Server: /****************************************************** OpenEdgeServiceImpl *******************************************************/ package ru.bis.integration.uek.service; import org.apache.log4j.Logger; import com.progress.open4gl.Open4GLException; import com.progress.open4gl.RunTimeProperties; import com.progress.open4gl.StringHolder; import com.progress.open4gl.dynamicapi.Session; import com.progress.open4gl.javaproxy.Connection; import static ru.bis.integration.uek.util.UekConstants.*; import ru.bis.integration.uek.proxy.OpenEdgeProxy; import ru.bis.integration.uek.service.exception.NotConnectedException; import ru.bis.integration.uek.service.exception.OpenEdgeCommunicationException; /** * * @author shds * */ public class OpenEdgeServiceImpl implements OpenEdgeService { private String url; private String userId; private String password; private String ifilial; private String appServerInfo; private OpenEdgeProxy proxy; private Connection conn; private static final Logger logger = Logger.getLogger(OpenEdgeServiceImpl.class); public OpenEdgeServiceImpl(String url, String userId, String password, String ifilial, String appServerInfo) { this.url = url; this.userId = userId; this.password = password; this.ifilial = ifilial; this.appServerInfo = appServerInfo; RunTimeProperties.setSessionModel(1); RunTimeProperties.setInitialConnections(10); logger.info("Session-free connection mode is used"); try { conn = new Connection(url, userId, password, appServerInfo); proxy = new OpenEdgeProxy(conn); logger.info("Initial connection pool size set to " + conn.getSessionPool().size()); } catch (Exception e) { logger.error(CONNECTION_ERROR_MESSAGE + LINE_SEPARATOR + e.getMessage()); return; } logger.info(CONNECTION_ESTABLISHED); } @Override public String sendMessage(String message) throws OpenEdgeCommunicationException, NotConnectedException { if (proxy == null) { initProxy(); } StringHolder response = new StringHolder(); try { proxy.iUekAll(userId, password, ifilial, message, response); logger.info("RequestID:" + proxy._getRequestId()); } catch (Exception e) { logger.error(COMMUNICATION_ERROR_MESSAGE + LINE_SEPARATOR + e + e.getMessage()); throw new OpenEdgeCommunicationException(COMMUNICATION_ERROR_MESSAGE); } return response.getStringValue(); } private void initProxy() throws NotConnectedException { try { proxy = new OpenEdgeProxy(conn); } catch (Exception e) { logger.error(CONNECTION_ERROR_MESSAGE + LINE_SEPARATOR + e); throw new NotConnectedException(CONNECTION_ERROR_MESSAGE); } } public void close() { try { proxy._cancelAllRequests(); conn.releaseConnection(); logger.info("Connections closed"); } catch (Open4GLException e) { logger.error(e.getMessage()); } } } /*******************************************************************************************************************/ OpenEdgeServiceImpl class is just Spring bean with singleton scope. Both the constructor and close() methods are called once on Tomcat startup and shutdown events. sendMessage(String message) method is called every time SOAP request comes to web-service. Thus, given multithreading nature of Tomcat, every request is running on separate thread, so each thread uses the same code from sendMessage(String message) method and the same proxy object. When I give my program load testing, I notice that session pool is rapidly growing up which leads to increasing number of connections. But the session pool size is limited to 25, so no more that 25 connections gets established. I need to find scalable decision that provides tolerance to high loadings. I thought that Session-free mode is silver bullet, that allows for using as many as needed OpenEdge broker agents when the loading is growing up. After all, given all previous facts I just like to know is this Java code correct??

Continue reading...
 
Status
Not open for further replies.
Top