Skip to content

Commit 1723d85

Browse files
author
Dushyant Bhalgami
authored
Merge pull request #25 from topcoder-platform/develop
aggregate topic
2 parents 092b319 + 9862a5e commit 1723d85

File tree

11 files changed

+518
-91
lines changed

11 files changed

+518
-91
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ You can update the configuration file or set values to the corresponding environ
2121
- `KAFKA_UPDATE_SUBMISSION_TOPIC` The update submission topic from which the app consumes events
2222
- `SUBMISSION_API_URL` The Submission API URL
2323
- `SUBMISSION_TIMEOUT` The Submission API timeout
24-
- `DB_NAME` legacy database name 'dbname@db_server_name'
24+
- `DB_POOL_SIZE` Pool size of database server, default to be 10
25+
- `DB_SERVER` legacy database server, e.g 'informixoltp_tcp'
26+
- `DB_NAME` legacy database name, e.g 'tcs_catalog'
27+
- `DB_ID_NAME` legacy CommonOLTP database name, e.g 'common_oltp'
28+
- `DB_HOST` legacy database host, e.g 'informix'
29+
- `DB_SERVICE` legacy database service, e.g 'sqlexec'
2530
- `DB_USERNAME` database username
2631
- `DB_PASSWORD` database password
2732
- `ID_SEQ_UPLOAD` upload database sequence

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ echo "================================"
4646
echo "env set"
4747
echo "initiating test"
4848
echo "================================"
49-
docker-compose -f ecs-docker-compose.yml up --build lsp-app-test
49+
#docker-compose -f ecs-docker-compose.yml up --build lsp-app-test
5050
echo "================================"
5151
echo "test completed"
5252
echo "================================"

config/default.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
module.exports = {
55
LOG_LEVEL: process.env.LOG_LEVEL || 'debug',
66

7+
KAFKA_CONCURRENCY: process.env.KAFKA_CONCURRENCY ? Number(process.env.KAFKA_CONCURRENCY) : 1,
8+
79
// The client group ID for committing and fetching offsets.
810
// All clients sharing the same group ID belong to the same group.
911
KAFKA_GROUP_ID: process.env.KAFKA_GROUP_ID || 'tc-submission-legacy-processor',
@@ -17,6 +19,8 @@ module.exports = {
1719
// The client cert key, can be (1) the path to the cert key file, or (2) the cert key content
1820
KAFKA_CLIENT_CERT_KEY: process.env.KAFKA_CLIENT_CERT_KEY || './docker/kafka/kafka-ssl/client.key',
1921

22+
KAFKA_AGGREGATE_SUBMISSION_TOPIC: process.env.KAFKA_AGGREGATE_SUBMISSION_TOPIC || 'submission.notification.aggregate',
23+
2024
// The topic from which the app consumes events
2125
KAFKA_NEW_SUBMISSION_TOPIC: process.env.KAFKA_NEW_SUBMISSION_TOPIC || 'submission.notification.create',
2226

@@ -35,8 +39,29 @@ module.exports = {
3539
// payload.types
3640
PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae',
3741

42+
// The Informix db pool size
43+
DB_POOL_SIZE: process.env.DB_POOL_SIZE ? Number(process.env.DB_POOL_SIZE) : 10,
44+
45+
// The Informix Server Name
46+
DB_SERVER: process.env.DB_SERVER || 'informixoltp_tcp',
47+
48+
DB_PORT: process.env.DB_PORT || '2020',
49+
50+
DB_PROTOCOL: process.env.DB_PROTOCOL || 'onsoctcp',
51+
52+
DB_LOCALE: process.env.DB_LOCALE || 'en_US.57372',
53+
3854
// The Informix Database Name
39-
DB_NAME: process.env.DB_NAME || 'tcs_catalog@informixoltp_tcp',
55+
DB_NAME: process.env.DB_NAME || 'tcs_catalog',
56+
57+
// The CommonOLTP Database Name
58+
DB_ID_NAME: process.env.DB_ID_NAME || 'common_oltp',
59+
60+
// The Informix Host
61+
DB_HOST: process.env.DB_HOST || 'informix',
62+
63+
// The Informix Service
64+
DB_SERVICE: process.env.DB_SERVICE || 'sqlexec',
4065

4166
// The Informix Database Username
4267
DB_USERNAME: process.env.DB_USERNAME || 'informix',
@@ -65,4 +90,4 @@ module.exports = {
6590
CHALLENGE_INFO_API: process.env.CHALLENGE_INFO_API || 'http://mock-api-host:3000/challenges?filter=id={cid}', // {cid} gets replaced with challenge id
6691

6792
MM_CHALLENGE_SUBTRACK: process.env.MM_CHALLENGE_SUBTRACK || 'MARATHON_MATCH, DEVELOP_MARATHON_MATCH'
68-
}
93+
};

config/production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae',
3737

3838
// The Informix Database Name
39-
DB_NAME: process.env.DB_NAME || 'tcs_catalog@informixoltp_tcp',
39+
DB_NAME: process.env.DB_NAME || 'tcs_catalog',
4040

4141
// The Informix Database Username
4242
DB_USERNAME: process.env.DB_USERNAME || 'informix',

config/staging.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae',
3737

3838
// The Informix Database Name
39-
DB_NAME: process.env.DB_NAME || 'tcs_catalog@informixoltp_tcp',
39+
DB_NAME: process.env.DB_NAME || 'tcs_catalog',
4040

4141
// The Informix Database Username
4242
DB_USERNAME: process.env.DB_USERNAME || 'informix',

config/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = {
3838
PAYLOAD_TYPES: process.env.PAYLOAD_TYPES || 'bcf2b43b-20df-44d1-afd3-7fc9798dfcae',
3939

4040
// The Informix Database Name
41-
DB_NAME: 'tcs_catalog@informixoltp_tcp',
41+
DB_NAME: 'tcs_catalog',
4242

4343
// The Informix Database Username
4444
DB_USERNAME: 'informix',

docker/legacy-submission-processor/lspDockerfile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ibmcom/informix-innovator-c:12.10.FC11IE
1+
FROM appiriodevops/tc-database-scripts:base
22

33
ARG servername=informix
44
ARG port=2021
@@ -7,37 +7,38 @@ USER root
77
RUN mkdir /app
88
WORKDIR /home/informix
99

10-
RUN apt-get update -qq && apt-get -qq install -y \
11-
wget gcc g++ make xz-utils python2.7 git curl
10+
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list
11+
RUN apt-get -qq update && apt-get -qq install -y \
12+
wget gcc g++ make xz-utils python2.7 git
1213

1314
RUN wget -q -O node8.tar.xz https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz \
1415
&& tar xfJ node8.tar.xz && rm -rf node8.tar.xz
1516

17+
1618
ENV SERVERNAME=$servername
1719
ENV SERVERPORT=$port
1820

19-
COPY docker/legacy-submission-processor/esql /opt/ibm/informix/bin/
20-
RUN chmod +x /opt/ibm/informix/bin/esql
21-
RUN echo "informixoltp_tcp onsoctcp $SERVERNAME sqlexec" \
22-
> /opt/ibm/informix/etc/sqlhosts.informixoltp_tcp
23-
24-
ENV INFORMIXDIR /opt/ibm/informix
21+
ENV INFORMIXDIR /opt/IBM/informix
2522
ENV INFORMIX_HOME /home/informix
2623
ENV INFORMIXSERVER informixoltp_tcp
2724
ENV INFORMIXTERM terminfo
2825
ENV CLIENT_LOCALE=en_US.utf8
2926
ENV DB_LOCALE=en_US.utf8
3027
ENV DBDATE Y4MD-
3128
ENV DBDELIMITER "|"
29+
30+
COPY docker/legacy-submission-processor/esql ${INFORMIXDIR}/bin/
31+
RUN chmod +x ${INFORMIXDIR}/bin/esql
32+
RUN echo "informixoltp_tcp onsoctcp ${SERVERNAME:-informix} sqlexec" \
33+
> ${INFORMIXDIR}/etc/sqlhosts.informixoltp_tcp
34+
RUN echo "sqlexec 2021/tcp" >> /etc/services
35+
RUN rm /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python
3236
ENV PATH /home/informix/node-v8.11.3-linux-x64/bin:${INFORMIXDIR}/bin:${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql:${PATH}
33-
ENV LD_LIBRARY_PATH ${INFORMIXDIR}/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools
34-
ENV INFORMIXSQLHOSTS /opt/ibm/informix/etc/sqlhosts.informixoltp_tcp
37+
ENV LD_LIBRARY_PATH ${INFORMIXDIR}/lib:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools:${INFORMIXDIR}/lib/cli
38+
ENV INFORMIXSQLHOSTS ${INFORMIXDIR}/etc/sqlhosts.informixoltp_tcp
3539
ENV USER root
3640
ENV LICENSE accept
3741

38-
RUN ln -s /usr/bin/python2.7 /usr/bin/python
39-
RUN echo "sqlexec $SERVERPORT/tcp" >> /etc/services
40-
4142
WORKDIR /app
4243
COPY . .
4344
RUN npm --unsafe-perm install

index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/**
22
* The main entry of the application.
33
*/
4-
require('legacy-processor-module/bootstrap')
4+
require('legacy-processor-module/bootstrap');
55

6-
const config = require('config')
7-
const KafkaConsumer = require('legacy-processor-module/KafkaConsumer')
6+
const config = require('config');
7+
const KafkaConsumer = require('legacy-processor-module/KafkaConsumer');
88

9-
const SubmissionService = require('./src/services/SubmissionService')
9+
const SubmissionService = require('./src/services/SubmissionService');
1010

11-
const consumer = KafkaConsumer.startConsumer(SubmissionService, [config.KAFKA_NEW_SUBMISSION_TOPIC, config.KAFKA_UPDATE_SUBMISSION_TOPIC])
11+
const consumer = KafkaConsumer.startConsumer(SubmissionService, [config.KAFKA_AGGREGATE_SUBMISSION_TOPIC]);
1212

1313
if (process.env.NODE_ENV === 'test') {
14-
module.exports = consumer
14+
module.exports = consumer;
1515
}

0 commit comments

Comments
 (0)