Skip to content

A simple Redis pub sub implementation that allows you to send and handle messages in a very convenient manner

License

Notifications You must be signed in to change notification settings

RivalGamesNET/Bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bridge

A simple redis pub sub implementation that allows you to send and handle messages in a very convenient manner

How to use

Creating an instance

        // Create a redisson config instance to initialize bridge with
        Config redissonConfig = new Config();
        redissonConfig.useSingleServer().setAddress("redis://127.0.0.1:6379");
        Bridge bridge = new Bridge("channel", redissonConfig);

Making events and listeners for events

@NoArgsConstructor
@AllArgsConstructor
public class BridgeTestEvent implements BridgeEvent {

    public int numberId;
    public String message;

    @Override
    public String toString(){
        return numberId + ";" + message;
    }
}
        // Register the incoming channel using the bridge instance
        bridge.registerListener(BridgeTestEvent.class, (charSequence, event) -> {
            System.out.println(event);
        });

Calling an event

         bridge.callEvent(new BridgeTestEvent(0, "helloWorld"));

About

A simple Redis pub sub implementation that allows you to send and handle messages in a very convenient manner

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages