com.ksc.mission.base.spring.beans.Config Maven / Gradle / Ivy
package com.ksc.mission.base.spring.beans;
import java.util.HashMap;
import java.util.Map;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import com.ksc.mission.base.activemq.BrokerConnector;
import com.ksc.mission.base.codegen.CodeGenerator;
import com.ksc.mission.base.http.HttpConnector;
import com.ksc.mission.base.http.HttpConnectorSpec;
import com.ksc.mission.base.interfaces.IMessageHub;
import com.ksc.mission.base.jms.JmsConnector;
import com.ksc.mission.base.logger.Logger;
import com.ksc.mission.base.objecttweet.MessageHub;
import com.ksc.mission.base.scheduler.ScheduleConnector;
@Configuration
@EnableJms
public class Config {
public static ApplicationContext applicationContext() {
return new AnnotationConfigApplicationContext(Config.class);
}
@Bean
IMessageHub messageHub() {
return new MessageHub();
}
@Bean
Map> headerMap() {
final Map> headerMap = new HashMap>();
return headerMap;
}
// @Bean(name = "PayerPortalConnector")
// public HttpConnector PayerPortalBatchHttpConnector(IMessageHub messageHub, HttpConnectorSpec httpConnectorSpec) {
// return new HttpConnector("PayerPortalConnector", httpConnectorSpec, messageHub);
// }
// @Bean
// ScheduleConnector scheduleConnector(IMessageHub messageHub) {
// return new ScheduleConnector(messageHub);
// }
// @Bean
// BrokerConnector brokerConnector(IMessageHub messageHub) {
// return new BrokerConnector(messageHub);
// }
//
// @Bean
// ConnectionFactory connectionFactory(BrokerConnector brokerConnector) {
// return brokerConnector.getConnectionFactory();
// }
//
// @Bean
// public JmsConnector jmsConnector(ConnectionFactory connectionFactory, IMessageHub messageHub) {
// try {
// return new JmsConnector(connectionFactory);
// } catch (JMSException e) {
// e.printStackTrace();
// }
// return null;
// }
// @Bean(name = "TestJmsTemplate")
// public JmsTemplate testJmsTemplate() {
// JmsTemplate template = new JmsTemplate();
// template.setConnectionFactory(testConnectionFactory());
// template.setDefaultDestination(testDestination());
// return template;
// }
// @Bean
// public DefaultMessageListenerContainer jmsContainer(JmsConnector jmsConnector) {
// return jmsConnector.createListener("TestQueue", (msg) -> {
// logDebug("Queue - TestQueue, Object - " + msg);
// });
// }
// @Bean
// CodeGenerator application(IMessageHub messageHub) {
// return new CodeGenerator(messageHub);
// }
// @Bean
// Logger logger(IMessageHub messageHub, Application application) {
// Logger logger = new Logger(messageHub);
// logger.subscribe(application, (msg) -> logDebug(msg));
// return logger;
// }
}