use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class ActiveMqPlugin method onApplicationStart.
@Override
public void onApplicationStart() {
Logger.info("ActiveMQ Plugin started");
try {
List<Class> jobClasses = new ArrayList<Class>();
for (ApplicationClass applicationClass : Play.classes.getAssignableClasses(ActiveMqJob.class)) {
if (Job.class.isAssignableFrom(applicationClass.javaClass)) {
jobClasses.add(applicationClass.javaClass);
}
}
MessageListener listener = new ActiveMqConsumer(jobClasses);
connectionFactory = new ActiveMQConnectionFactory();
// receive
receiveConnection = connectionFactory.createTopicConnection();
receiveConnection.start();
receiveSession = receiveConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
receiveTopic = receiveSession.createTopic("playMessages");
receiveSubscriber = receiveSession.createSubscriber(receiveTopic);
receiveSubscriber.setMessageListener(listener);
// send
sendingConnection = connectionFactory.createTopicConnection();
sendingConnection.start();
sendingSession = sendingConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
sendingTopic = sendingSession.createTopic("playMessages");
sendingPublisher = sendingSession.createPublisher(sendingTopic);
} catch (Exception e) {
Logger.error(e, "Could not start activemq broker");
}
}
use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class SearchHelperPlugin method getIndexedFields.
private List<String> getIndexedFields(ApplicationClass applicationClass) {
try {
Class clazz = applicationClass.javaClass;
List<String> fieldList = (List<String>) clazz.getMethod("getIndexedFields").invoke(null);
return fieldList;
} catch (Exception e) {
}
return Collections.emptyList();
}
use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class SearchHelperPlugin method isIndexed.
private boolean isIndexed(ApplicationClass applicationClass) {
try {
Class clazz = applicationClass.javaClass;
Boolean isIndexed = (Boolean) clazz.getMethod("isIndexed").invoke(null);
return isIndexed;
} catch (Exception e) {
}
return false;
}
Aggregations