Subject: How to have client, service and broker co-located using UIMA-AS


Hi Manuel, you *can* colocate broker, client and a service in the same
process. Here is the code to get this done. Sorry did not test this. You
need to create a deployment descriptor (xml file) to be able to deploy a
service.

// Deploy in-process broker
String uri = "tcp://"localhost:61616";
BrokerService broker =
     BrokerFactory.createBroker(new
URI("broker:()/localhost?persistent=false"));
TransportConnector tcpConnector = broker.addConnector(uri);
broker.start();
//------------------

UimaAsynchronousEngine client =
new BaseUIMAAsynchronousEngine_impl();

Map<String,String> appCtx = new HashMap();
appCtx.put(UimaAsynchronousEngine.DD2SpringXsltFilePath,
           $UIMA_HOME+"/bin/dd2spring.xsl");
appCtx.put(UimaAsynchronousEngine.SaxonClasspath,
           "file:"+$UIMA_HOME+"/saxon/saxon8.jar");

String aDeploymentDescriptorPath =
  <path to dd.xml>

// deploy in-process service
String serviceId =
  client.deploy(aDeploymentDescriptorPath, appCtx);

String endpoint = <queue name>; // from the deployment descriptor

appCtx.put(UimaAsynchronousEngine.ServerUri, uri);
appCtx.put(UimaAsynchronousEngine.ENDPOINT, endpoint);

// connect client with an in-process service
client.initialize(appCtx);

CAS cas = client.getCAS();
cas.setDocumentText("Some Text");
client.sendCAS(cas);

client.stop();

On Wed, Oct 4, 2017 at 11:37 AM, Manuel Fiorelli <[EMAIL PROTECTED]>
wrote: