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

listening to rabbitmq queue and printing the message

parent caec712e
Branches
Tags
1 merge request!6Trusted ibm
Showing
with 56 additions and 105 deletions
......@@ -65,7 +65,7 @@ public class RecordIndexerApi {
}
try {
if (recordChangedMessages == null) {
// log.info("record change messages is null");
log.info("record change messages is null");
}
Type listType = new TypeToken<List<RecordInfo>>() {
......@@ -73,7 +73,7 @@ public class RecordIndexerApi {
List<RecordInfo> recordInfos = new Gson().fromJson(recordChangedMessages.getData(), listType);
if (recordInfos.size() == 0) {
// log.info("none of record-change message can be deserialized");
log.info("none of record-change message can be deserialized");
return new ResponseEntity(HttpStatus.OK);
}
this.indexerService.processRecordChangedMessages(recordChangedMessages, recordInfos);
......
##server.servlet.contextPath=/api/indexer/v2
logging.level.org.springframework.web=DEBUG
server.port=8080
JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M
JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45
PUBSUB_SEARCH_TOPIC=records-changed
AUTHORIZE_API=https://entitlements-dot-opendes.appspot.com/entitlements/v1
STORAGE_HOSTNAME=os-storage-dot-opendes.appspot.com
GOOGLE_AUDIENCES=245464679631-ktfdfpl147m1mjpbutl00b3cmffissgq.apps.googleusercontent.com
#
## must update redis hosts at runtime appropriate to deployment environment
REDIS_GROUP_HOST=REDIS-GROUP-HOST
REDIS_SEARCH_HOST=REDIS-SEARCH-HOST
#
## use 127.0.0.1 for local run/debug mode
REDIS_GROUP_HOST=127.0.0.1
REDIS_STORAGE_HOST=127.0.0.1
#
## use below values for gcp: opendes
REDIS_GROUP_HOST=10.0.16.28
REDIS_STORAGE_HOST=10.0.16.12
#
REDIS_GROUP_PORT=6379
REDIS_SEARCH_PORT=6379
DEFAULT_DATA_COUNTRY=US
......@@ -46,7 +46,10 @@
<artifactId>os-core-lib-ibm</artifactId>
<version>0.0.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
......
......@@ -35,39 +35,6 @@ public class ElasticSettingSchema {
private String usernameAndPassword;
@NotEmpty
private boolean isHttps;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getUsernameAndPassword() {
return usernameAndPassword;
}
public void setUsernameAndPassword(String usernameAndPassword) {
this.usernameAndPassword = usernameAndPassword;
}
public boolean isHttps() {
return isHttps;
}
public void setHttps(boolean isHttps) {
this.isHttps = isHttps;
}
private boolean isHttps;
}
......@@ -53,11 +53,7 @@ public class ElasticSettingSchemaRepositoryImpl implements ISchemaRepository {
@Override
public void add(ElasticSettingSchema schema, String id) {
ElasticSettingsDoc sd = new ElasticSettingsDoc();
ElasticSettingsDoc sd = new ElasticSettingsDoc();
sd.setId(id);
sd.setSettingSchema(schema);
db.save(sd);
......
......@@ -24,7 +24,6 @@ import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ElasticSettingsDoc {
public static final String DB_NAME = "SearchSettings"; //collection name
......@@ -37,29 +36,5 @@ public class ElasticSettingsDoc {
public void setId(String id) {
this._id = id;
}
public String get_id() {
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
public String get_rev() {
return _rev;
}
public void set_rev(String _rev) {
this._rev = _rev;
}
public ElasticSettingSchema getSettingSchema() {
return settingSchema;
}
public void setSettingSchema(ElasticSettingSchema settingSchema) {
this.settingSchema = settingSchema;
}
}
\ No newline at end of file
......@@ -54,15 +54,12 @@ public class PublisherImpl implements IPublisher {
String tenant = headers.getPartitionId();
if (Strings.isNullOrEmpty(tenant))
tenant = headers.getAccountId();
Map<String, String> message = new HashMap<>();
message.put(tenant, headers.getPartitionIdWithFallbackToAccountId());
headers.addCorrelationIdIfMissing();
message.put(DpsHeaders.CORRELATION_ID, headers.getCorrelationId());
RecordChangedMessages recordChangedMessages = getRecordChangedMessage(headers, indexerBatchStatus);
message.put("data", recordChangedMessages.toString());
......
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);
}
}
#server.servlet.contextPath=/api/indexer/v2/
logging.level.org.springframework.web=DEBUG
server.port=8080
server.port=8060
JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M
JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45
......@@ -11,9 +11,9 @@ AUTHORIZE_API=https://entitlements-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f2075
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_KEY=dummy
#CRS_API=https://opendesproxy.azurewebsites.net/crs/v1
#CRS_API_KEY=dummy
PUBSUB_SEARCH_TOPIC=ic-r2-dev-osdu-queue
STORAGE_HOSTNAME=os-storage-ibm-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud
#Default Cache Settings
SCHEMA_CACHE_EXPIRATION=60
......@@ -36,17 +36,13 @@ STORAGE_QUERY_RECORD_HOST=https://os-storage-ibm-osdu-r2.osduadev-a1c3eaf78a8680
STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST=https://os-storage-ibm-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud/api/storage/v2/query/records:batch
STORAGE_RECORDS_BATCH_SIZE=20
## Update after indexer-queue deploy at OCP
INDEXER_QUEUE_HOST=https://requeuefunction-cd1.azurewebsites.net/api/re-enqueue
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://keycloak-osdu-r2.osduadev-a1c3eaf78a86806e299f5f3f207556f0-0000.us-south.containers.appdomain.cloud/auth/realms/OSDU/protocol/openid-connect/certs
#spring.security.user.name=opendes@byoc.local
#spring.security.user.password=123
#spring.security.user.roles=service.indexer.admin
ibm.cloudant.dbname.prefix=mvn-build
ibm.env.prefix=ic-r2-dev
ibm.cloudant.url=https://5be9693e-3324-400a-aadc-59908c132be2-bluemix.cloudant.com
ibm.cloudant.apikey=0TsJrjBedUyyu4DhtpxcoL-D8vnHUsPlT5r8A-1IN4SE
......@@ -56,7 +52,6 @@ ibm.tenant.cloudant.apikey=0TsJrjBedUyyu4DhtpxcoL-D8vnHUsPlT5r8A-1IN4SE
ibm.rabbitmq.uri=amqps://ibm_cloud_45338a90_9047_4927_a6a4_67cd2f7ad9f7:32769652ee6c161f72fd4bcee2929a1866178092b90d22e7f0d7650b8d3b6fa1@e6530902-b278-496b-92bb-230dd55edf86.bn2a2vgd01r3l0hfmvc0.databases.appdomain.cloud:30270
#Indexer-Queue-header
indexer.queue.key=abcd
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment