Skip to content
Snippets Groups Projects
Commit b628a214 authored by Alan Braz's avatar Alan Braz
Browse files

moved queue listenet to indexer-queue

parent e92a8407
No related branches found
No related tags found
1 merge request!6Trusted ibm
Showing
with 52 additions and 77 deletions
...@@ -46,10 +46,7 @@ ...@@ -46,10 +46,7 @@
<artifactId>os-core-lib-ibm</artifactId> <artifactId>os-core-lib-ibm</artifactId>
<version>0.0.12-SNAPSHOT</version> <version>0.0.12-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId> <artifactId>spring-boot-starter-security</artifactId>
......
...@@ -28,24 +28,24 @@ public class IndexerIBMApplication { ...@@ -28,24 +28,24 @@ public class IndexerIBMApplication {
public static void main(String[] args) { public static void main(String[] args) {
// We can't load things from Spring properties at this point // We can't load things from Spring properties at this point
if (System.getenv().containsKey("INSECURE_HOSTNAMES")) { // if (System.getenv().containsKey("INSECURE_HOSTNAMES")) {
// This must be one of the first things to run // // This must be one of the first things to run
//
List<String> insecureHostnames = Arrays.asList(System.getenv("INSECURE_HOSTNAMES").split(":")); // List<String> insecureHostnames = Arrays.asList(System.getenv("INSECURE_HOSTNAMES").split(":"));
//
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier( // javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
//
new javax.net.ssl.HostnameVerifier() { // new javax.net.ssl.HostnameVerifier() {
//
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { // public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
if (insecureHostnames.contains(hostname)) { // if (insecureHostnames.contains(hostname)) {
return true; // return true;
} // }
return false; // return false;
//
} // }
}); // });
} // }
SpringApplication.run(IndexerIBMApplication.class, args); SpringApplication.run(IndexerIBMApplication.class, args);
} }
} }
package org.opengroup.osdu.indexer.ibm.di;
import javax.inject.Inject;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.core.common.multitenancy.ITenantInfoService;
import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;
@RequestScope
@Component
public class TenantInfoService implements ITenantInfoService {
@Inject
private ITenantFactory tenantFactory;
@Inject
private DpsHeaders headers;
@Override
public TenantInfo getTenantInfo() {
return tenantFactory.getTenantInfo(headers.getPartitionId());
}
}
package org.opengroup.osdu.indexer.ibm.queue;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableRabbit
public class MessagingConfiguration {
@Value("${ibm.rabbitmq.uri}")
private String RABBITMQ_ADDRESS;
@Bean
public CachingConnectionFactory rabbitConnectionFactory(RabbitProperties config) throws Exception {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
connectionFactory.getRabbitConnectionFactory().setUri(RABBITMQ_ADDRESS);
return connectionFactory;
}
}
\ No newline at end of file
package org.opengroup.osdu.indexer.ibm.queue;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
public class Subcriber {
@RabbitListener(queues="${PUBSUB_SEARCH_TOPIC}")
public void recievedMessage(Message message) {
byte[] body = message.getBody();
String msg = new String(body);
System.out.println("Recieved Message: " + msg);
}
}
...@@ -39,9 +39,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -39,9 +39,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/swagger", "/swagger",
"/swagger-ui.html", "/swagger-ui.html",
"/webjars/**").permitAll() "/webjars/**").permitAll()
.anyRequest().authenticated() .anyRequest().anonymous();
.and() //.authenticated()
.oauth2ResourceServer().jwt(); //.and()
//.oauth2ResourceServer().jwt();
//changed the http authentication to jwt authetication. //changed the http authentication to jwt authetication.
} }
} }
...@@ -22,7 +22,6 @@ import javax.inject.Inject; ...@@ -22,7 +22,6 @@ import javax.inject.Inject;
import org.opengroup.osdu.core.common.model.http.DpsHeaders; import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.search.Preconditions; import org.opengroup.osdu.core.common.search.Preconditions;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope; import org.springframework.web.context.annotation.RequestScope;
...@@ -35,7 +34,7 @@ import lombok.extern.java.Log; ...@@ -35,7 +34,7 @@ import lombok.extern.java.Log;
public class HeadersInfoIBMImpl implements IHeadersInfo { public class HeadersInfoIBMImpl implements IHeadersInfo {
@Inject @Inject
@Qualifier("dpsHeaderFactorySearch") //@Qualifier("dpsHeaderFactorySearch")
private DpsHeaders headersMap; private DpsHeaders headersMap;
@Value("${indexer.queue.key}") @Value("${indexer.queue.key}")
......
...@@ -41,7 +41,7 @@ import com.google.common.base.Strings; ...@@ -41,7 +41,7 @@ import com.google.common.base.Strings;
public class RequestInfoImpl implements IRequestInfo { public class RequestInfoImpl implements IRequestInfo {
@Inject @Inject
@Qualifier("dpsHeaderFactorySearch") //@Qualifier("dpsHeaderFactorySearch")
private DpsHeaders dpsHeaders; private DpsHeaders dpsHeaders;
@Inject @Inject
......
#server.servlet.contextPath=/api/indexer/v2/ server.servlet.contextPath=/api/indexer/v2/
LOG_PREFIX=indexer
logging.level.org.springframework.web=DEBUG logging.level.org.springframework.web=DEBUG
server.port=8060 server.port=8060
JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M
...@@ -11,8 +12,6 @@ AUTHORIZE_API=https://entitlements-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f2075 ...@@ -11,8 +12,6 @@ AUTHORIZE_API=https://entitlements-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f2075
AUTHORIZE_API_KEY=tobeupdated AUTHORIZE_API_KEY=tobeupdated
LEGALTAG_API=https://os-legal-ibm-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud/api/legal/v1 LEGALTAG_API=https://os-legal-ibm-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud/api/legal/v1
PUBSUB_SEARCH_TOPIC=ic-r2-dev-osdu-queue
STORAGE_HOSTNAME=os-storage-ibm-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud STORAGE_HOSTNAME=os-storage-ibm-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud
#Default Cache Settings #Default Cache Settings
...@@ -42,8 +41,6 @@ spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://keycloak-osdu-r2.o ...@@ -42,8 +41,6 @@ spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://keycloak-osdu-r2.o
#spring.security.user.password=123 #spring.security.user.password=123
#spring.security.user.roles=service.indexer.admin #spring.security.user.roles=service.indexer.admin
ibm.env.prefix=ic-r2-dev
ibm.cloudant.url=https://5be9693e-3324-400a-aadc-59908c132be2-bluemix.cloudant.com ibm.cloudant.url=https://5be9693e-3324-400a-aadc-59908c132be2-bluemix.cloudant.com
ibm.cloudant.apikey=0TsJrjBedUyyu4DhtpxcoL-D8vnHUsPlT5r8A-1IN4SE ibm.cloudant.apikey=0TsJrjBedUyyu4DhtpxcoL-D8vnHUsPlT5r8A-1IN4SE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment