Skip to content

Commit

Permalink
Update jvm size and Notification part separate
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjangid05 committed Jun 6, 2023
1 parent 0085108 commit bedecb4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ WORKDIR $HOME
COPY --from=build $HOME/target/*.jar app.jar

EXPOSE 8080
ENTRYPOINT ["java","-Xmx350m","-Xshareclasses","-XX:+CMSClassUnloadingEnabled","-XX:+UseG1GC","-XX:+ExplicitGCInvokesConcurrent","-jar","app.jar"]
ENTRYPOINT ["java","-Xmx1024m","-Xshareclasses","-XX:+CMSClassUnloadingEnabled","-XX:+UseG1GC","-XX:+ExplicitGCInvokesConcurrent","-jar","app.jar"]
22 changes: 20 additions & 2 deletions src/main/java/com/uci/orchestrator/Consumer/OuboundConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,33 @@ public class OuboundConsumer {
@Value("${outbound}")
private String outboundTopic;

@Value("${notificationOutbound}")
public String notificationOutbound;

@Autowired
public SimpleProducer kafkaProducer;

private long consumeCount, pushNotificationCount, pushOtherCount;


@KafkaListener(id = "${processOutbound}", topics = "${processOutbound}", properties = {"spring.json.value.default.type=java.lang.String"})
public void onMessage(@Payload String stringMessage) {
try {
consumeCount++;
log.info("OutboundConsumer:onMessage:: Consume Topic Count: " + consumeCount);
XMessage msg = XMessageParser.parse(new ByteArrayInputStream(stringMessage.getBytes()));
kafkaProducer.send(outboundTopic, msg.toXML());
} catch(JAXBException e) {
if (msg != null && msg.getProvider() != null && msg.getProvider().equalsIgnoreCase("firebase")
&& msg.getChannel().equalsIgnoreCase("web")) {
pushNotificationCount++;
log.info("OutboundConsumer:onMessage:: Notification push to kafka topic count: " + pushNotificationCount);
kafkaProducer.send(notificationOutbound, msg.toXML());
} else {
pushOtherCount++;
log.info("OutboundConsumer:onMessage:: Other push to kafka topic count: " + pushOtherCount);
kafkaProducer.send(outboundTopic, msg.toXML());
}

} catch (JAXBException e) {
e.printStackTrace();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ broadcast-transformer=${KAFKA_BROADCAST_TRANSFORMER_TOPIC:#{"broadcast-transform
generic-transformer=${KAFKA_GENERIC_TRANSFORMER_TOPIC:#{"generic-transformer"}}
processOutbound=${KAFKA_PROCESS_OUTBOUND}
outbound=${KAFKA_OUTBOUND_TOPIC}
notificationOutbound=${KAFKA_NOTIFICATION_TOPIC}

# Cassandra
#spring.data.cassandra.contactpoints=${CASSANDRA_URL}
Expand Down

0 comments on commit bedecb4

Please sign in to comment.