-
Notifications
You must be signed in to change notification settings - Fork 8
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
Inform admins when new oauth2 account is created using spring rabbit events (gateway) #54
Conversation
gateway/pom.xml
Outdated
@@ -66,6 +66,16 @@ | |||
<artifactId>lombok</artifactId> | |||
<optional>true</optional> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.amqp</groupId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gateway is a spring-boot project, use the spring-boot-starter-amqp dependency instead, version managed by the spring-boot BOM
gateway/src/main/java/org/georchestra/gateway/security/oauth2/OpenIdConnectUserMapper.java
Outdated
Show resolved
Hide resolved
gateway/src/main/java/org/georchestra/gateway/events/EventsListener.java
Outdated
Show resolved
Hide resolved
@Slf4j(topic = "org.georchestra.gateway.events") | ||
public class EventsListener implements MessageListener { | ||
|
||
private static Set<String> receivedMessageUid = new HashSet<String>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought receivedMessageUid
was not used, didn't see the dependency on synReceivedMessageUid
. Still confusing, why not instead of:
private static Set<String> receivedMessageUid = new HashSet<String>();
private static Set<String> synReceivedMessageUid = Collections.synchronizedSet(receivedMessageUid);
do just:
private static Set<String> synReceivedMessageUid = Collections.synchronizedSet(new HashSet<>());
gateway/src/main/java/org/georchestra/gateway/events/EventsSender.java
Outdated
Show resolved
Hide resolved
gateway/src/main/java/org/georchestra/gateway/events/EventsListener.java
Outdated
Show resolved
Hide resolved
50bd6c0
to
7e8d0c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EventsConfiguration is an autoconfiguration, please rename as EventsAutoConfiguration for the sake of conventions. Also, it is imperative that it's conditional in some form, and not enabled by default, for backwards compatibility. The gateway shall keep being able to deploy without a rabbitmq at all.
You can add for example @Profile("rabbitmq")
, then the configuration class will only engage when the app is launched with the spring "rabbitmq" profile.
gateway/pom.xml
Outdated
<version>20230618</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax</groupId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment on why this is needed? otherwise it'll look strange on a webflux project
gateway/src/main/java/org/georchestra/gateway/security/oauth2/OpenIdConnectUserMapper.java
Outdated
Show resolved
Hide resolved
7e8d0c4
to
ef46c38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ef46c38
to
af3ed2d
Compare
I made use of property "enableRabbitmqEvents" because I need to check it before calling rabbitMQSender in "OpenIdConnectUserMapper.java". I think this way we can activate to desactivate rabbitmq autoconfiguration. |
3e41ecb
to
c56c0f0
Compare
Can someone merge this one if it's OK with you ? |
Please wait I finish with port issues, Thanks |
c56c0f0
to
b2cb416
Compare
On this PR, we made use of spring rabbit events to send message from gateway to console in order to inform admin about new created OAuth2 account