-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example for publishing events via NATS
- Loading branch information
1 parent
2c55f26
commit 16bb873
Showing
9 changed files
with
194 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
NATS Support | ||
--- | ||
|
||
``` | ||
nats context add localhost --description "Localhost" | ||
``` | ||
|
||
Add username / password in context config | ||
``` | ||
vi ~/.config/nats/context/localhost.json | ||
``` | ||
|
||
List contexts | ||
``` | ||
nats context ls | ||
``` | ||
|
||
Select context | ||
``` | ||
nats ctx select localhost | ||
``` | ||
|
||
Nats subscribe to keycloak subject | ||
``` | ||
nats sub acme.iam.keycloak> | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
accounts: { | ||
$SYS: { | ||
users: [ | ||
{ user: "admin", password: "password" } | ||
] | ||
}, | ||
KEYCLOAK: { | ||
jetstream: enabled, | ||
users: [ | ||
{ user: "keycloak", password: "keycloak" } | ||
] | ||
} | ||
} | ||
|
||
jetstream {} | ||
|
||
#cluster: { | ||
# name: LOCAL, | ||
# port: 6222, | ||
# routes: [ | ||
# "nats://acme_nats_1:6222" | ||
# ] | ||
#} |
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
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
14 changes: 14 additions & 0 deletions
14
...c/main/java/com/github/thomasdarimont/keycloak/custom/eventpublishing/EventPublisher.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.thomasdarimont.keycloak.custom.eventpublishing; | ||
|
||
import java.util.Map; | ||
|
||
public interface EventPublisher { | ||
|
||
void publish(String topic, Object event); | ||
|
||
Map<String, String> getOperationalInfo(); | ||
|
||
void init(); | ||
|
||
void close(); | ||
} |
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
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