Search in sources :

Example 1 with ClientParameters

use of com.rabbitmq.http.client.ClientParameters in project tutorials by jhkim105.

the class RabbitClientTest method delete.

@Test
void delete() throws Exception {
    String apiUrl = "http://localhost:15672/api";
    String username = "guest";
    String password = "guest";
    Client client = new Client(new ClientParameters().url(apiUrl).username(username).password(password));
    List<QueueInfo> queueInfoList = client.getQueues();
    queueInfoList.forEach(qi -> client.deleteQueue("/", qi.getName()));
}
Also used : QueueInfo(com.rabbitmq.http.client.domain.QueueInfo) ClientParameters(com.rabbitmq.http.client.ClientParameters) Client(com.rabbitmq.http.client.Client) Test(org.junit.jupiter.api.Test)

Example 2 with ClientParameters

use of com.rabbitmq.http.client.ClientParameters in project hop by rabbitmq.

the class SanityCheck method main.

public static void main(String[] args) {
    try {
        Client c = new Client(new ClientParameters().url("http://127.0.0.1:15672/api/").username("guest").password("guest"));
        c.getOverview();
        LoggerFactory.getLogger("rabbitmq").info("Test succeeded with Hop {}", Client.class.getPackage().getImplementationVersion());
        System.exit(0);
    } catch (Exception e) {
        LoggerFactory.getLogger("rabbitmq").info("Test failed", e);
        System.exit(1);
    }
}
Also used : ClientParameters(com.rabbitmq.http.client.ClientParameters) Client(com.rabbitmq.http.client.Client)

Example 3 with ClientParameters

use of com.rabbitmq.http.client.ClientParameters in project hop by rabbitmq.

the class AppTest method createUseClient.

@Test
void createUseClient() throws Exception {
    HttpLayerFactory httpLayerFactory = JdkHttpClientHttpLayer.configure().clientBuilderConsumer(clientBuilder -> clientBuilder.connectTimeout(Duration.ofSeconds(10))).requestBuilderConsumer(requestBuilder -> requestBuilder.timeout(Duration.ofSeconds(10)).setHeader("Authorization", authorization("guest", "guest"))).create();
    Client c = new Client(new ClientParameters().url("http://127.0.0.1:15672/api/").username("guest").password("guest").httpLayerFactory(httpLayerFactory));
    c.getOverview();
}
Also used : Test(org.junit.jupiter.api.Test) JdkHttpClientHttpLayer.authorization(com.rabbitmq.http.client.JdkHttpClientHttpLayer.authorization) Duration(java.time.Duration) JdkHttpClientHttpLayer(com.rabbitmq.http.client.JdkHttpClientHttpLayer) ClientParameters(com.rabbitmq.http.client.ClientParameters) Client(com.rabbitmq.http.client.Client) HttpLayerFactory(com.rabbitmq.http.client.HttpLayer.HttpLayerFactory) ClientParameters(com.rabbitmq.http.client.ClientParameters) HttpLayerFactory(com.rabbitmq.http.client.HttpLayer.HttpLayerFactory) Client(com.rabbitmq.http.client.Client) Test(org.junit.jupiter.api.Test)

Aggregations

Client (com.rabbitmq.http.client.Client)3 ClientParameters (com.rabbitmq.http.client.ClientParameters)3 Test (org.junit.jupiter.api.Test)2 HttpLayerFactory (com.rabbitmq.http.client.HttpLayer.HttpLayerFactory)1 JdkHttpClientHttpLayer (com.rabbitmq.http.client.JdkHttpClientHttpLayer)1 JdkHttpClientHttpLayer.authorization (com.rabbitmq.http.client.JdkHttpClientHttpLayer.authorization)1 QueueInfo (com.rabbitmq.http.client.domain.QueueInfo)1 Duration (java.time.Duration)1