All Downloads are FREE. Search and download functionalities are using the official Maven repository.

driven-adapter.rsocket-requester.config.requester-config.mustache Maven / Gradle / Ivy

Go to download

Gradle plugin to create a clean application in Java that already works, It follows our best practices!

There is a newer version: 3.20.10
Show newest version
package {{package}}.rsocket.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.codec.cbor.Jackson2CborDecoder;
import org.springframework.http.codec.cbor.Jackson2CborEncoder;
import org.springframework.messaging.rsocket.RSocketRequester;
import org.springframework.messaging.rsocket.RSocketStrategies;

@Configuration
public class RequesterConfig {

    @Bean
    public RSocketRequester rSocketRequester(RSocketStrategies rSocketStrategies) {
        RSocketStrategies strategies = RSocketStrategies.builder()
            .encoders(encoders -> encoders.add(new Jackson2CborEncoder()))
            .decoders(decoders -> decoders.add(new Jackson2CborDecoder()))
            .build();
        return RSocketRequester.builder()
            .rsocketStrategies(strategies)
            .dataMimeType(MediaType.APPLICATION_CBOR)
            .tcp("localhost",7000); // server IP or DNS, and port
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy