Skip to content

Commit 079fd56

Browse files
committed
reactify-core
1 parent b5e297f commit 079fd56

File tree

107 files changed

+418
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+418
-341
lines changed

reactify-core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
Copyright 2024-2025 the original author Hoàng Anh Tiến
3+
Copyright 2024-2025 the original author Hoàng Anh Tiến.
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -27,9 +27,9 @@
2727
<!-- =========================================== -->
2828
<!-- The maven central for all the library -->
2929
<!-- =========================================== -->
30-
<groupId>io.github.hoangtien2k3</groupId>
30+
<groupId>com.ezbuy.platform</groupId>
3131
<artifactId>reactify-core</artifactId>
32-
<version>1.2.6</version>
32+
<version>1.2.5</version>
3333
<name>reactify-core</name>
3434
<description>Java library for developing reactive programming(reactor-core) backend systems in microservices</description>
3535
<url>https://github.com/hoangtien2k3/reactify-core</url>

reactify-core/src/main/java/com/reactify/annotations/LocalCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/LogPerformance.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/Loggable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/cache/CacheAspect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/cache/CacheStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/cache/CacheUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/cache/CustomizeRemovalListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/logging/LoggerAspect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

reactify-core/src/main/java/com/reactify/annotations/logging/LoggerAspectUtils.java

Lines changed: 16 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024-2025 the original author Hoàng Anh Tiến
2+
* Copyright 2024-2025 the original author Hoàng Anh Tiến.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -123,11 +123,11 @@ public Mono<Object> logAround(ProceedingJoinPoint joinPoint) throws Throwable {
123123

124124
Span newSpan = tracer.nextSpan().name(name);
125125
var result = joinPoint.proceed();
126-
if (result instanceof Mono<?> monoResult) {
126+
if (result instanceof Mono) {
127127
return logMonoResult(
128128
joinPoint,
129129
start,
130-
monoResult.cast(Object.class),
130+
(Mono<Object>) result,
131131
newSpan,
132132
name,
133133
logType,
@@ -136,11 +136,11 @@ public Mono<Object> logAround(ProceedingJoinPoint joinPoint) throws Throwable {
136136
logInput,
137137
title);
138138
}
139-
if (result instanceof Flux<?> fluxResult) {
139+
if (result instanceof Flux) {
140140
return logFluxResult(
141141
joinPoint,
142142
start,
143-
fluxResult.cast(Object.class),
143+
(Flux<Object>) result,
144144
newSpan,
145145
name,
146146
logType,
@@ -149,7 +149,7 @@ public Mono<Object> logAround(ProceedingJoinPoint joinPoint) throws Throwable {
149149
logInput,
150150
title)
151151
.collectList()
152-
.map(list -> list);
152+
.map(list -> (Object) list);
153153
} else {
154154
return Mono.just(result);
155155
}
@@ -264,30 +264,13 @@ private Flux<Object> logFluxResult(
264264
boolean logInput,
265265
String title) {
266266
var contextRef = new AtomicReference<Context>();
267-
if (logInput) {
268-
Object[] args = joinPoint.getArgs();
269-
logPerf(contextRef, newSpan, name, start, "INPUT", null, logType, actionType, args, title);
270-
}
271-
return result.doOnNext(output -> {
272-
if (logOutput) {
273-
logPerf(
274-
contextRef,
275-
newSpan,
276-
name,
277-
start,
278-
"OUTPUT",
279-
null,
280-
logType,
281-
actionType,
282-
new Object[] {output},
283-
title);
284-
}
267+
return result.doFinally(
268+
o -> logPerf(contextRef, newSpan, name, start, "1", null, logType, actionType, null, title))
269+
.contextWrite(context -> {
270+
contextRef.set(context);
271+
return context;
285272
})
286-
.doOnError(error ->
287-
logPerf(contextRef, newSpan, name, start, "0", error, logType, actionType, null, title))
288-
.doFinally(signalType ->
289-
logPerf(contextRef, newSpan, name, start, "1", null, logType, actionType, null, title))
290-
.contextWrite(context -> contextRef.updateAndGet(ctx -> context));
273+
.doOnError(o -> logPerf(contextRef, newSpan, name, start, "0", o, logType, actionType, null, title));
291274
}
292275

293276
/**
@@ -307,45 +290,15 @@ private Flux<Object> logFluxResult(
307290
* @param result
308291
* a string indicating the result status ("0" for success, "1" for
309292
* failure)
310-
* @param data
293+
* @param o
311294
* the output object from the method execution, may be {@code null}
312295
*/
313296
private void logPerf(
314-
AtomicReference<Context> contextRef,
315-
Span newSpan,
316-
String name,
317-
long start,
318-
String result,
319-
Object data,
320-
String logType,
321-
String actionType,
322-
String title) {
323-
if (newSpan != null) {
324-
newSpan.finish();
325-
}
297+
AtomicReference<Context> contextRef, Span newSpan, String name, Long start, String result, Object o) {
298+
newSpan.finish();
326299
long duration = System.currentTimeMillis() - start;
327300
if (duration < 50) return;
328-
329-
Context context = contextRef != null ? contextRef.get() : Context.empty();
330-
String contextInfo = context != null ? context.toString() : "-";
331-
String dataInfo = "-";
332-
if (data != null) {
333-
if (data instanceof Throwable error) {
334-
dataInfo = String.format("Error: %s - %s", error.getClass().getSimpleName(), error.getMessage());
335-
} else {
336-
dataInfo = data.toString();
337-
}
338-
}
339-
logPerf.info(
340-
"{} | {} | {} | {} | {} | {} | {} | {}",
341-
title,
342-
name,
343-
duration,
344-
result,
345-
logType,
346-
actionType,
347-
contextInfo,
348-
dataInfo);
301+
logPerf.info("{} {} {} M2 {}", name, duration, result, o == null ? "-" : o.toString());
349302
}
350303

351304
/**

0 commit comments

Comments
 (0)