Skip to content

Changed log levels #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Build and Push Docker tag Image
command: |
# Set environment variables
IMAGE_TAG=importer_rdbms_2
IMAGE_TAG=$CIRCLE_TAG
# Check if the Docker image with the same tag already exists in Docker Hub
if curl -s -f -u "$DOCKERHUB_USERNAME":"$DOCKERHUB_PASSWORD" "https://hub.docker.com/v2/repositories/openmf/ph-ee-importer-rdbms/tags/$IMAGE_TAG" > /dev/null; then
echo "Skipping the build and push as the tag $IMAGE_TAG already exists in Docker Hub."
Expand Down Expand Up @@ -50,9 +50,9 @@ jobs:
- run:
name: Build Docker image
command: |
IMAGE_TAG=importer_rdbms_2
IMAGE_TAG=$CIRCLE_TAG
./gradlew clean bootJar
docker build -t openmf/ph-ee-importer-rdbms:importer_rdbms_2 .
docker build -t openmf/ph-ee-importer-rdbms:latest .
# Log in to DockerHub using environment variables
- run:
name: Login to DockerHub
Expand All @@ -61,7 +61,7 @@ jobs:
# Push the Docker image to DockerHub
- run:
name: Push Docker image to DockerHub
command: docker push openmf/ph-ee-importer-rdbms:importer_rdbms_2
command: docker push openmf/ph-ee-importer-rdbms:latest

workflows:
version: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public class InflightBatchManager {

public Batch retrieveOrCreateBatch(String bpmn, DocumentContext record) {
Long processInstanceKey = record.read("$.value.processInstanceKey", Long.class);
Optional<TransferTransformerConfig.Flow> config = transferTransformerConfig.findFlow(bpmn);
Batch batch = batchRepository.findByWorkflowInstanceKey(processInstanceKey);
if (batch == null) {
logger.debug("creating new Batch for processInstanceKey: {}", processInstanceKey);
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/hu/dpc/phee/operator/streams/RecordParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class RecordParser {

@Transactional
public List<Object> processWorkflowInstance(DocumentContext recordDocument, String bpmn, Long workflowInstanceKey, Long timestamp, String bpmnElementType, String elementId, String flowType, DocumentContext sample) {
logger.info("Processing workflow instance");
logger.debug("Processing workflow instance type");
String recordType = recordDocument.read("$.recordType", String.class);
String intent = recordDocument.read("$.intent", String.class);
Optional<TransferTransformerConfig.Flow> config = transferTransformerConfig.findFlow(bpmn);
Expand All @@ -90,7 +90,7 @@ public List<Object> processWorkflowInstance(DocumentContext recordDocument, Stri
.toList();

if ("TRANSFER".equalsIgnoreCase(flowType)) {
logger.info("Processing flow of type TRANSFER");
logger.debug("Processing flow of type TRANSFER");
Transfer transfer = inFlightTransferManager.retrieveOrCreateTransfer(bpmn, sample);
if ("EVENT".equals(recordType) && "START_EVENT".equals(bpmnElementType) && "ELEMENT_ACTIVATED".equals(intent)) {
transfer.setStartedAt(new Date(timestamp));
Expand All @@ -108,7 +108,7 @@ public List<Object> processWorkflowInstance(DocumentContext recordDocument, Stri
constantTransformers.forEach(it -> applyTransformer(transfer, null, null, it));
transferRepository.save(transfer);
} else if ("TRANSACTION-REQUEST".equalsIgnoreCase(flowType)) {
logger.info("Processing flow of type TRANSACTION");
logger.debug("Processing flow of type TRANSACTION");
TransactionRequest transactionRequest = inflightTransactionRequestManager.retrieveOrCreateTransaction(bpmn, sample);
if ("ELEMENT_ACTIVATING".equals(intent)) {
transactionRequest.setStartedAt(new Date(timestamp));
Expand All @@ -126,7 +126,7 @@ public List<Object> processWorkflowInstance(DocumentContext recordDocument, Stri
constantTransformers.forEach(it -> applyTransformer(transactionRequest, null, null, it));
transactionRequestRepository.save(transactionRequest);
} else if ("BATCH".equalsIgnoreCase(flowType)) {
logger.info("Processing flow of type BATCH");
logger.debug("Processing flow of type BATCH");
Batch batch = inflightBatchManager.retrieveOrCreateBatch(bpmn, sample);
if ("ELEMENT_ACTIVATING".equals(intent)) {
batch.setStartedAt(new Date(timestamp));
Expand All @@ -141,7 +141,7 @@ public List<Object> processWorkflowInstance(DocumentContext recordDocument, Stri
constantTransformers.forEach(it -> applyTransformer(batch, null, null, it));
batchRepository.save(batch);
} else if ("OUTBOUND_MESSAGES".equalsIgnoreCase(flowType)) {
logger.info("Processing flow of type OUTBOUND MESSAGES");
logger.debug("Processing flow of type OUTBOUND MESSAGES");
OutboudMessages outboudMessages = inflightOutboundMessageManager.retrieveOrCreateOutboundMessage(bpmn, recordDocument);
if ("ELEMENT_ACTIVATING".equals(intent)) {
outboudMessages.setSubmittedOnDate(new Date(timestamp));
Expand All @@ -157,7 +157,7 @@ public List<Object> processWorkflowInstance(DocumentContext recordDocument, Stri
}

public List<Object> processVariable(DocumentContext recordDocument, String bpmn, Long workflowInstanceKey, Long workflowKey, Long timestamp, String flowType, DocumentContext sample) {
logger.info("Processing variable instance");
logger.debug("Processing variable instance");
String variableName = recordDocument.read("$.value.name", String.class);
String variableValue = recordDocument.read("$.value.value", String.class);
String value = variableValue.startsWith("\"") && variableValue.endsWith("\"") ? StringEscapeUtils.unescapeJson(variableValue.substring(1, variableValue.length() - 1)) : variableValue;
Expand Down Expand Up @@ -218,7 +218,7 @@ private void matchTransformerForFlowType(String flowType, String bpmn, DocumentC
}

public List<Object> processTask(DocumentContext recordDocument, Long workflowInstanceKey, String valueType, Long workflowKey, Long timestamp) {
logger.info("Processing task instance");
logger.debug("Processing task instance");
return List.of(
new Task()
.withWorkflowInstanceKey(workflowInstanceKey)
Expand All @@ -233,7 +233,7 @@ public List<Object> processTask(DocumentContext recordDocument, Long workflowIns

@Transactional
public List<Object> processIncident(Long timestamp, String flowType, String bpmn, DocumentContext sample, Long workflowInstanceKey) {
logger.info("Processing incident instance");
logger.debug("Processing incident instance");
if ("TRANSFER".equalsIgnoreCase(flowType)) {
Transfer transfer = inFlightTransferManager.retrieveOrCreateTransfer(bpmn, sample);
logger.warn("failing Transfer {} based on incident event", transfer.getTransactionId());
Expand Down Expand Up @@ -287,7 +287,7 @@ private void applyTransformer(Object object, String variableName, String variabl
// It's a JSON object
processJsonObject(jsonNode,transformer,object,fieldName,variableName,variableValue);
} else {
System.err.println("Invalid JSON input.");
logger.error("Invalid JSON input.");
}
} catch (IOException e) {
e.printStackTrace();
Expand Down Expand Up @@ -319,7 +319,7 @@ private void applyTransformer(Object object, String variableName, String variabl
private void processJsonObject(JsonNode jsonNode, TransferTransformerConfig.Transformer transformer, Object object, String fieldName, String variableName, String variableValue) {
DocumentContext document = JsonPath.parse(jsonNode.toString());
Object result = document.read(transformer.getJsonPath());
logger.info("Results:{}",result);
logger.debug("Results:{}",result);

String value = null;
if (result != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hu/dpc/phee/operator/streams/StreamsSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void process(Object _key, Object _value) {
default -> throw new IllegalStateException("Unexpected event type: " + valueType);
};
if (entities.size() != 0) {
logger.info("Saving {} entities", entities.size());
logger.debug("Saving {} entities", entities.size());
entities.forEach(entity -> {
if (entity instanceof Variable) {
variableRepository.save((Variable) entity);
Expand All @@ -198,7 +198,7 @@ public void process(Object _key, Object _value) {
}
});
} catch (Exception e) {
logger.error("failed to process batch", e);
logger.error("failed to process entity", e);

} finally {
ThreadLocalContextUtil.clear();
Expand Down
22 changes: 21 additions & 1 deletion src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,22 @@ transfer:
transformers:
- field: internalId
variableName: internalId
- field: tenantId
variableName: tenantId
- field: response
variableName: deliveryMessage
- field: message
variableName: messageType
- field: externalId
variableName: transactionId
variableName: externalId
- field: mobileNumber
variableName: phoneNumber
- field: deliveryStatus
variableName: deliveryStatus
- field: message
variableName: deliveryMessage
- field: bridgeId
variableName: bridgeId
- name: bulk_processor
direction: UNKNOWN
type: BATCH
Expand All @@ -37,10 +45,14 @@ transfer:
variableName: tenantId
- field: requestFile
variableName: filename
- field: resultFile
variableName: filename
- field: registeringInstitutionId
variableName: registeringInstituteId
- field: correlationId
variableName: clientCorrelationId
- field: requestId
variableName: requestId
- field: requestId
variableName: transactionList
jsonPath: $.request_id
Expand All @@ -60,10 +72,14 @@ transfer:
variableName: tenantId
- field: requestFile
variableName: filename
- field: resultFile
variableName: filename
- field: registeringInstitutionId
variableName: registeringInstituteId
- field: correlationId
variableName: clientCorrelationId
- field: requestId
variableName: requestId
- field: requestId
variableName: transactionList
jsonPath: $.request_id
Expand All @@ -83,10 +99,14 @@ transfer:
variableName: tenantId
- field: requestFile
variableName: filename
- field: resultFile
variableName: filename
- field: registeringInstitutionId
variableName: registeringInstituteId
- field: correlationId
variableName: clientCorrelationId
- field: requestId
variableName: requestId
- field: requestId
variableName: transactionList
jsonPath: $.request_id
Expand Down