This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.9 | |
WORKDIR /code | |
COPY ./ /code/ | |
RUN apt-get update | |
#RUN apt-get install -y iputils-ping | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
ENV MONGO_URL=mongodb://root:rootpassword@mongodb_container:27017/db_sms?retryWrites=true&w=majority | |
ENV KAFKA_URL=kafka:29092 | |
CMD ["uvicorn","app.main:app", "--host","0.0.0.0", "--port", "80"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.9' | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:latest | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
ports: | |
- 22181:2181 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openjdk:8 | |
WORKDIR /smppsim | |
COPY ./conf /smppsim/conf | |
COPY ./docs /smppsim/docs | |
COPY ./lib /smppsim/lib | |
COPY ./www /smppsim/www | |
COPY ./deliver_messages.csv /smppsim/ | |
COPY ./smppsim.jar /smppsim/ | |
EXPOSE 2775 88 | |
CMD ["java", "-Djava.net.preferIPv4Stack=true", "-Djava.util.logging.config.file=/smppsim/conf/logging.properties", "-jar", "/smppsim/smppsim.jar", "/smppsim/conf/smppsim.props"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM gradle:4.10.0-jdk8-alpine AS build | |
COPY --chown=gradle:gradle ./src /home/gradle/src | |
COPY --chown=gradle:gradle ./lib /home/gradle/lib | |
COPY --chown=gradle:gradle ./build.gradle /home/gradle/build.gradle | |
WORKDIR /home/gradle | |
RUN mv src/main/resources/application.docker.properties src/main/resources/application.properties | |
# change config to use docker config ( not best practice as spring cloud support external config server) | |
RUN gradle build --no-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class SmsServiceImpl implements SmsService { | |
ObjectMapper objectMapper = new ObjectMapper(); | |
private static final Logger LOGGER = LoggerFactory.getLogger(SmsServiceImpl.class); | |
private TransmitterQueue transmitterQueue; | |
private ReceiverQueue receiverQueue; | |
private TransceiverQueue transceiverQueue; | |
@Value("${sms.transmitter.active}") | |
private boolean transmitterEnabled; | |
@Value("${sms.transmitter.username}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
public class Application implements CommandLineRunner { | |
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); | |
@Autowired | |
private SmsService smsService; | |
@Override | |
public void run(String... args) throws Exception { | |
LOGGER.info("running"); | |
Runtime.getRuntime().addShutdownHook(new Thread(() -> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseAsyncQueue implements SmppQueue, ConnectionObserver { | |
private static final Logger LOGGER = LoggerFactory.getLogger(BaseAsyncQueue.class); | |
private QueueEvent queueEvent; | |
protected final ConcurrentHashMap<String, AsynchronousData> queueItems = new ConcurrentHashMap<>(); | |
protected final ConcurrentHashMap<String, AsynchronousData> sendingItems = new ConcurrentHashMap<>(); | |
protected String host; | |
protected int port; | |
protected boolean isSmpp34; | |
private boolean bound; | |
protected SubmitSM submitSM; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsynchronousData { | |
private String src; | |
private String dest; | |
private String msgId; | |
private Date requestDate; | |
private String content; | |
private boolean longMsg; | |
private int lang; | |
public AsynchronousData(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class KafkaTopicConfig { | |
private static final Logger LOGGER = LoggerFactory.getLogger( KafkaTopicConfig.class); | |
@Value(value = "${kafka.bootstrapAddress}") | |
private String bootstrapAddress; | |
@Bean | |
public KafkaAdmin kafkaAdmin() { | |
LOGGER.info("kafka admin address "+bootstrapAddress); | |
Map<String, Object> configs = new HashMap<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from tkinter.messagebox import NO | |
from fastapi import FastAPI, Body, HTTPException, status,Header | |
from fastapi.responses import JSONResponse | |
from fastapi.encoders import jsonable_encoder | |
from typing import Final, Optional, List | |
import motor.motor_asyncio | |
from kafka import KafkaConsumer,KafkaProducer | |
import hashlib | |
import base64 |
NewerOlder