资源简介
包含通过http方式调用rabbitmq对外接口,如查看队列的有效性、获取交换机等信息
包含通过http方式调用rabbitmq对外接口,如查看队列的有效性、获取交换机等信息
包含通过http方式调用rabbitmq对外接口,如查看队列的有效性、获取交换机等信息
包含通过http方式调用rabbitmq对外接口,如查看队列的有效性、获取交换机等信息
代码片段和文件信息
package com.test;
import javax.xml.bind.DatatypeConverter;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
public class Test {
public static void main(String[] args) throws Exception {
// /api/queues/vhost/name
// /api/queues
String httpurl = “http://server:15672/api/queues/%2F/sitech.devops.deploy.queue/bindings“;
/**
* 1.初始化client
*/
String CODE_ENCODING = “UTF-8“;
HttpParams httpParams = new BasicHttpParams();
httpParams.setParameter(“charset“ CODE_ENCODING);
SchemeRegistry schreg = new SchemeRegistry();
schreg.register(new Scheme(“http“80PlainSocketFactory.getSocketFactory()));
schreg.register(new Scheme(“https“ 443 SSLSocketFactory.getSocketFactory()));
PoolingClientConnectionManager pccm = new PoolingClientConnectionManager(schreg);
pccm.setDefaultMaxPerRoute(20); //每个主机的最大并行链接数
pccm.setMaxTotal(100); //客户端总并行链接最大数
DefaultHttpClient client = new DefaultHttpClient(pccmhttpParams);
/**
* 2.连接
*/
HttpGet get = new HttpGet(httpurl);
get.addHeader(“Content-Type“ “application/json;charset=“ + CODE_ENCODING);
get.setHeader(“Accept“ “application/json“);
get.setHeader(“Content-Type“ “application/json;charset=“ + CODE_ENCODING);
String authorization = DatatypeConverter.printbase64Binary(“guest:guest“.getBytes(“UTF-8“));
System.out.println(authorization);
get.setHeader(“Authorization“ “Basic “+authorization);
HttpResponse res = client.execute(get);
int statusCode = res.getStatusLine().getStatusCode();
// 判断返回编码是否为200
if (statusCode != 200 && statusCode != 201) {
throw new Exception(“Get “ + httpurl + “Error!Response Code “ + statusCode);
}
HttpEntity entity = res.getEntity();
String response = EntityUtils.toString(entity CODE_ENCODING);
System.out.println(response);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 561 2018-03-01 15:33 RabbitMQHttpApi\.classpath
文件 391 2018-03-01 15:31 RabbitMQHttpApi\.project
文件 598 2018-03-01 15:31 RabbitMQHttpApi\.settings\org.eclipse.jdt.core.prefs
文件 3857 2018-03-01 15:36 RabbitMQHttpApi\bin\com\test\Test.class
文件 305001 2017-06-24 09:34 RabbitMQHttpApi\lib\commons-httpclient-3.1.jar
文件 52915 2016-10-13 16:15 RabbitMQHttpApi\lib\commons-logging-1.1.jar
文件 433368 2018-02-01 09:14 RabbitMQHttpApi\lib\httpclient-4.2.5.jar
文件 227275 2018-02-01 09:14 RabbitMQHttpApi\lib\httpcore-4.2.4.jar
文件 2463 2018-03-01 15:36 RabbitMQHttpApi\src\com\test\Test.java
目录 0 2018-03-01 15:33 RabbitMQHttpApi\bin\com\test
目录 0 2018-03-01 15:32 RabbitMQHttpApi\src\com\test
目录 0 2018-03-01 15:33 RabbitMQHttpApi\bin\com
目录 0 2018-03-01 15:32 RabbitMQHttpApi\src\com
目录 0 2018-03-01 15:31 RabbitMQHttpApi\.settings
目录 0 2018-03-01 15:33 RabbitMQHttpApi\bin
目录 0 2018-03-01 15:32 RabbitMQHttpApi\lib
目录 0 2018-03-01 15:32 RabbitMQHttpApi\src
目录 0 2018-03-01 15:31 RabbitMQHttpApi
----------- --------- ---------- ----- ----
1026429 18
- 上一篇:千套网站设计模板及源码
- 下一篇:主轴零件图
相关资源
- RabbitMQ实战视频.zip
- springboot使用rabbitmq工具类
- rabbitMQ代码案例
- MSMQ、RabbitMQ、ActiveMQ消息队列调试工具
- great_project.zip
- spring集成rabbitMq(基于direct、topic和
- rabbitmq-demo学习
- SpringBoot+redis+RabbitMq整合
- RabbitMQ消息中间件技术精讲包含源码等
- RabbitMQ客户端连接池的原理及源码
- rabbitmq-server-windows-3.6.10.zip
- rabbitmq-server-3.7.18-1.el7.noarch.rpm
- rabbitmq-server-3.7.17-1.el7.noarch.rpm
- rabbitmq-server-3.7.6-1.el7.noarch.rpm
- 1 SpringBoot整合RabbitMQ-整合配置篇-源码
- SpringBoot+WebSocket+RabbitMQ实时消息推送
- rabbitmq-server-generic-unix-3.7.12.tar.xz
- RabbitMQ_SDK
- rabbitmq_pro.zip
- linux使用消息队列实现进程间双向通信
- RabbitMq+Haproxy
- Centos6.9下RabbitMQ高可用集群完整部署记
- rabbitmq 测试工具
- springboot+websocket+Stomp+RabbitMq 实现多人
- RabbitMQ客户端Qt项目工程
评论
共有 条评论