use of org.apache.ofbiz.service.config.model.JmsService in project ofbiz-framework by apache.
the class JmsServiceEngine method run.
protected Map<String, Object> run(ModelService modelService, Map<String, Object> context) throws GenericServiceException {
JmsService serviceElement = getServiceElement(modelService);
List<Server> serverList = serviceElement.getServers();
Map<String, Object> result = new HashMap<String, Object>();
for (Server server : serverList) {
String serverType = server.getType();
if ("topic".equals(serverType))
result.putAll(runTopic(modelService, context, server));
else if ("queue".equals(serverType))
result.putAll(runQueue(modelService, context, server));
else
throw new GenericServiceException("Illegal server messaging type.");
}
return result;
}
use of org.apache.ofbiz.service.config.model.JmsService in project ofbiz-framework by apache.
the class JmsListenerFactory method loadListeners.
// Load the JMS listeners
private void loadListeners() {
try {
List<JmsService> jmsServices = ServiceConfigUtil.getServiceEngine().getJmsServices();
if (Debug.verboseOn())
Debug.logVerbose("Loading JMS Listeners.", module);
for (JmsService service : jmsServices) {
StringBuilder serverKey = new StringBuilder();
for (Server server : service.getServers()) {
try {
if (server.getListen()) {
// create a server key
serverKey.append(server.getJndiServerName() + ":");
serverKey.append(server.getJndiName() + ":");
serverKey.append(server.getTopicQueue());
// store the server element
servers.put(serverKey.toString(), server);
// load the listener
GenericMessageListener listener = loadListener(serverKey.toString(), server);
// store the listener w/ the key
if (serverKey.length() > 0 && listener != null)
listeners.put(serverKey.toString(), listener);
}
} catch (GenericServiceException gse) {
Debug.logInfo("Cannot load message listener " + serverKey + " error: (" + gse.toString() + ").", module);
} catch (Exception e) {
Debug.logError(e, "Uncaught exception.", module);
}
}
}
} catch (GenericConfigException e) {
Debug.logError(e, "Exception thrown while loading JMS listeners: ", module);
}
}
Aggregations