更新amqp

This commit is contained in:
wangkang
2017-08-16 15:39:53 +08:00
parent 73c33b5e9b
commit ee4d0307cd
14 changed files with 0 additions and 1265 deletions
-5
View File
@@ -25,10 +25,5 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<!-- spring-boot-starter-amqp -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
</dependencies>
</project>
@@ -1,28 +0,0 @@
/**
* Consumer.java
* Created at 2017-05-23
* Created by Administrator
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import java.lang.annotation.*;
/**
* 描述 : Consumer
*
* @author Administrator
*/
@Documented
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Consumer {
/**
* 描述 : 消费者代码
*
* @return value
*/
String value() default "";
}
@@ -1,54 +0,0 @@
/**
* IRabbitmqListener.java
* Created at 2016-11-17
* Created by wangkang
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Queue;
/**
* 描述 : IRabbitmqListener
*
* @author wangkang
*/
public interface IRabbitmqListener<T> {
/**
* 描述 : 消费者队列(Bean)
*
* @return Queue
*/
Queue queue();
/**
* 描述 : 死信消费者队列(Bean)
*
* @return Queue
*/
Queue dlxQueue();
/**
* 描述 : 绑定(Bean)
*
* @return Binding
*/
Binding binding();
/**
* 描述 : 死信绑定(Bean)
*
* @return Binding
*/
Binding dlxBinding();
/**
* 描述 : 处理消息
*
* @param message 消息
*/
void process(RabbitmqMessage<T> message);
}
@@ -1,123 +0,0 @@
/**
* Rabbitmq.java
* Created at 2016-11-17
* Created by wangkang
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import org.itkk.udf.amqp.rabbitmq.meta.ProducerMeta;
import org.itkk.udf.amqp.rabbitmq.meta.PublisherMeta;
import org.itkk.udf.core.exception.PermissionException;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 描述 : Rabbitmq
*
* @author wangkang
*/
@Component
public class Rabbitmq {
/**
* 描述 : 应用名称
*/
@Value("${spring.application.name}")
private String springApplicationName;
/**
* 描述 : rabbitmqProperties
*/
@Autowired
private RabbitmqProperties rabbitmqProperties;
/**
* 描述 : amqpTemplate
*/
@Autowired
private AmqpTemplate amqpTemplate;
/**
* 描述 : Convert a Java object to an Amqp Message and send it to a specific exchange with a
* specific routing key.
*
* @param producerCode producerCode
* @param message a message to send
* @param <T> 任意类型
*/
public <T> void convertAndSend(String producerCode, RabbitmqMessage<T> message) {
//校验
verification(producerCode);
//获得交换机和路由键
String exchange = getExchange(producerCode);
String routingKey = getRoutingKey(producerCode);
//构造消息
this.buildMessage(message, producerCode, exchange, routingKey);
//发送
this.amqpTemplate.convertAndSend(exchange, routingKey, message);
}
/**
* 描述 : 获得交换机
*
* @param producerCode producerCode
* @return Exchange
*/
private String getExchange(String producerCode) {
return rabbitmqProperties.getProducer().get(producerCode).getExchange();
}
/**
* 描述 : 获得路由键
*
* @param producerCode producerCode
* @return RoutingKey
*/
private String getRoutingKey(String producerCode) {
return rabbitmqProperties.getProducer().get(producerCode).getRoutingKey();
}
/**
* 描述 : 校验
*
* @param producerCode producerCode
*/
private void verification(String producerCode) {
PublisherMeta publisherMeta = rabbitmqProperties.getPublisher().get(springApplicationName);
ProducerMeta producerMeta = rabbitmqProperties.getProducer().get(producerCode);
if (publisherMeta != null) {
if (publisherMeta.getPurview().indexOf(producerCode) == -1) {
throw new PermissionException("no access to this producerCode : " + producerCode);
}
} else {
throw new PermissionException("Publisher:" + springApplicationName + " not definition");
}
if (producerMeta == null) {
throw new PermissionException("Producer:" + producerCode + " not definition");
}
}
/**
* 描述 : 构建消息
*
* @param <T> 任意类型
* @param message message
* @param producerCode producerCode
* @param exchange exchange
* @param routingKey routingKey
*/
private <T> void buildMessage(RabbitmqMessage<T> message, String producerCode, String exchange,
String routingKey) {
message.setProducerCode(producerCode);
message.setSender(springApplicationName);
message.setExchange(exchange);
message.setRoutingKey(routingKey);
message.setSendDate(new Date());
}
}
@@ -1,90 +0,0 @@
/**
* RabbitmqListenerAuthAspect.java
* Created at 2016-11-17
* Created by wangkang
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.itkk.udf.amqp.rabbitmq.meta.ConsumerMeta;
import org.itkk.udf.amqp.rabbitmq.meta.SubscriberMeta;
import org.itkk.udf.core.exception.PermissionException;
/**
* 描述 : RabbitmqListenerAuthAspect
*
* @author wangkang
*/
@Aspect
@Component
@Order(99)
public class RabbitmqListenerAuthAspect extends RabbitmqListenerBaseAspect {
/**
* 描述 : 应用名称
*/
@Value("${spring.application.name}")
private String springApplicationName;
/**
* 描述 : rabbitmqProperties
*/
@Autowired
private RabbitmqProperties rabbitmqProperties;
/**
* 描述 : 前置通知
*
* @param joinPoint joinPoint
*/
@Before("listenerAspect()")
public void before(JoinPoint joinPoint) {
if (joinPoint.getTarget() instanceof IRabbitmqListener) {
//获得当前类的consumerCode
String consumerCode = getConsumerCode(joinPoint);
//获得消息
RabbitmqMessage<?> message = (RabbitmqMessage<?>) joinPoint.getArgs()[0];
//验证
verification(consumerCode, message);
}
}
/**
* 描述 : 校验
*
* @param consumerCode consumerCode
* @param message message
*/
private void verification(String consumerCode, RabbitmqMessage<?> message) {
//获得subscriberMeta
SubscriberMeta subscriberMeta = rabbitmqProperties.getSubscriber().get(springApplicationName);
//获得consumerMeta
ConsumerMeta consumerMeta = rabbitmqProperties.getConsumer().get(consumerCode);
//判断订阅者是否有此consumerCode的权限
if (subscriberMeta != null) {
if (subscriberMeta.getPurview().indexOf(consumerCode) == -1) {
throw new PermissionException("no access to this consumerCode : " + consumerCode);
}
} else {
throw new PermissionException("Subscriber:" + springApplicationName + " not definition");
}
//判断此consumerCode的权限
if (consumerMeta != null) {
if (message.getProducerCode().equals(consumerMeta.getProducer())) {
throw new PermissionException(
"no access to this ProducerCode : " + message.getProducerCode());
}
} else {
throw new PermissionException("Consumer:" + consumerCode + " not definition");
}
}
}
@@ -1,102 +0,0 @@
/**
* RabbitmqListenerAspect.java
* Created at 2016-11-17
* Created by wangkang
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Pointcut;
import org.itkk.udf.core.exception.SystemRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;
/**
* 描述 : RabbitmqListenerBaseAspect
*
* @author wangkang
*/
public class RabbitmqListenerBaseAspect {
/**
* 描述 : 日志
*/
private static final Logger LOGGER = LoggerFactory.getLogger(RabbitmqListenerBaseAspect.class);
/**
* 描述 : listenerAspect
*/
@Pointcut("execution(void org.itkk..*.process(..)) "
+ "and @annotation(org.springframework.amqp.rabbit.annotation.RabbitListener) "
+ "and this(org.itkk.udf.amqp.rabbitmq.IRabbitmqListener)")
protected void listenerAspect() {
LOGGER.debug("RabbitmqListenerBaseAspect.listenerAspect");
}
/**
* 描述 : 获得对列名称
*
* @param joinPoint joinPoint
* @return 对列名称
*/
@SuppressWarnings("rawtypes")
protected String getQueues(JoinPoint joinPoint) {
try {
String targetName = joinPoint.getTarget().getClass().getName();
String methodName = joinPoint.getSignature().getName();
Object[] arguments = joinPoint.getArgs();
Class targetClass = Class.forName(targetName);
Method[] methods = targetClass.getMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
Class[] clazzs = method.getParameterTypes();
if (clazzs.length == arguments.length) { //NOSONAR
return Arrays.toString(method.getAnnotation(RabbitListener.class).queues());
}
}
}
} catch (ClassNotFoundException e) {
throw new SystemRuntimeException(e);
}
return null;
}
/**
* 描述 : 获得consumerCode
*
* @param joinPoint joinPoint
* @return consumerCode
*/
protected String getConsumerCode(JoinPoint joinPoint) { //NOSONAR
String methodName = joinPoint.getSignature().getName();
Method[] methods = joinPoint.getTarget().getClass().getMethods();
for (Method method : methods) { //循环方法
if (method.getName().equals(methodName)) { //定位方法
if (method.isAnnotationPresent(Consumer.class)) { //判断是否包含Consumer注解
for (Annotation anno : method.getDeclaredAnnotations()) { //NOSONAR //循环注解
if (anno.annotationType().equals(Consumer.class)) { //定位注解
Consumer consumer = (Consumer) anno; //获得注解
if (StringUtils.isNotBlank(consumer.value())) { //判断值
return consumer.value(); //返回
} else {
throw new SystemRuntimeException("@Consumer value is null");
}
}
}
} else {
throw new SystemRuntimeException(
"You must use the @Consumer annotation to mark the IRabbitmqListener method");
}
}
}
return null;
}
}
@@ -1,79 +0,0 @@
/**
* RabbitmqListenerLogAspect.java
* Created at 2016-11-17
* Created by wangkang
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 描述 : RabbitmqListenerLogAspect
*
* @author wangkang
*/
@Aspect
@Component
@Order(100)
public class RabbitmqListenerLogAspect extends RabbitmqListenerBaseAspect {
/**
* 描述 : 日志
*/
private static final Logger LOGGER = LoggerFactory.getLogger(RabbitmqListenerLogAspect.class);
/**
* 描述 : 前置通知
*
* @param joinPoint joinPoint
*/
@Before("listenerAspect()")
public void before(JoinPoint joinPoint) {
if (joinPoint.getTarget() instanceof IRabbitmqListener) {
RabbitmqMessage<?> message = (RabbitmqMessage<?>) joinPoint.getArgs()[0];
String queues = this.getQueues(joinPoint);
LOGGER.info("{},{},receiveDate:{}", queues, message.getId(), new Date().getTime());
}
}
/**
* 描述 : 后置通知
*
* @param joinPoint joinPoint
*/
@After("listenerAspect()")
public void after(JoinPoint joinPoint) {
if (joinPoint.getTarget() instanceof IRabbitmqListener) {
RabbitmqMessage<?> message = (RabbitmqMessage<?>) joinPoint.getArgs()[0];
String queues = this.getQueues(joinPoint);
LOGGER.info("{},{},completeDate:{}", queues, message.getId(), new Date().getTime());
}
}
/**
* 异常通知
*
* @param joinPoint joinPoint
* @param ex ex
*/
@AfterThrowing(pointcut = "listenerAspect()", throwing = "ex")
public void fterThrowing(JoinPoint joinPoint, Exception ex) {
if (joinPoint.getTarget() instanceof IRabbitmqListener) {
RabbitmqMessage<?> message = (RabbitmqMessage<?>) joinPoint.getArgs()[0];
String queues = this.getQueues(joinPoint);
LOGGER.info("{},{},errorDate:{}", queues, message.getId(), new Date().getTime(), ex);
}
}
}
@@ -1,278 +0,0 @@
/**
* Message.java
* Created at 2016-09-19
* Created by wangkang
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
/**
* 描述 : 消息
*
* @author wangkang
*/
public class RabbitmqMessage<T> implements Serializable {
/**
* 描述 : id
*/
private static final long serialVersionUID = 1L;
/**
* 描述 : 消息ID
*/
private String id;
/**
* 发送者
*/
private String sender;
/**
* 描述 : 生产者编号
*/
private String producerCode;
/**
* 描述 : 交换机
*/
private String exchange;
/**
* 描述 : 路由键
*/
private String routingKey;
/**
* 描述 : 时间戳
*/
private Long timestamp;
/**
* 描述 : 消息创建时间
*/
private Date createDate;
/**
* 描述 : 消息发送时间
*/
private Date sendDate;
/**
* 描述 : 消息头
*/
private Map<String, String> header;
/**
* 描述 : 消息体
*/
private T body; //NOSONAR
/**
* 描述 : 构造函数
*/
public RabbitmqMessage() {
super();
}
/**
* 描述 : 构造函数
*
* @param header 消息头
* @param body 消息体
*/
public RabbitmqMessage(Map<String, String> header, T body) {
super();
this.id = UUID.randomUUID().toString();
this.createDate = new Date();
this.timestamp = createDate.getTime();
this.header = header;
this.body = body;
}
/**
* 描述 : 获取producerCode
*
* @return the producerCode
*/
public String getProducerCode() {
return producerCode;
}
/**
* 描述 : 设置producerCode
*
* @param producerCode the producerCode to set
*/
public void setProducerCode(String producerCode) {
this.producerCode = producerCode;
}
/**
* 描述 : 获取sender
*
* @return the sender
*/
public String getSender() {
return sender;
}
/**
* 描述 : 设置sender
*
* @param sender the sender to set
*/
public void setSender(String sender) {
this.sender = sender;
}
/**
* 描述 : 获取timestamp
*
* @return the timestamp
*/
public Long getTimestamp() {
return timestamp;
}
/**
* 描述 : 设置timestamp
*
* @param timestamp the timestamp to set
*/
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
/**
* 描述 : 获取exchange
*
* @return the exchange
*/
public String getExchange() {
return exchange;
}
/**
* 描述 : 设置exchange
*
* @param exchange the exchange to set
*/
public void setExchange(String exchange) {
this.exchange = exchange;
}
/**
* 描述 : 获取routingKey
*
* @return the routingKey
*/
public String getRoutingKey() {
return routingKey;
}
/**
* 描述 : 设置routingKey
*
* @param routingKey the routingKey to set
*/
public void setRoutingKey(String routingKey) {
this.routingKey = routingKey;
}
/**
* 描述 : 获取sendDate
*
* @return the sendDate
*/
public Date getSendDate() {
return sendDate;
}
/**
* 描述 : 设置sendDate
*
* @param sendDate the sendDate to set
*/
public void setSendDate(Date sendDate) {
this.sendDate = sendDate;
}
/**
* 描述 : 获取createDate
*
* @return the createDate
*/
public Date getCreateDate() {
return createDate;
}
/**
* 描述 : 设置createDate
*
* @param createDate the createDate to set
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* 描述 : 获取header
*
* @return the header
*/
public Map<String, String> getHeader() {
return header;
}
/**
* 描述 : 设置header
*
* @param header the header to set
*/
public void setHeader(Map<String, String> header) {
this.header = header;
}
/**
* 描述 : 获取id
*
* @return the id
*/
public String getId() {
return id;
}
/**
* 描述 : 设置id
*
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* 描述 : 获取body
*
* @return the body
*/
public T getBody() {
return body;
}
/**
* 描述 : 设置body
*
* @param body the body to set
*/
public void setBody(T body) {
this.body = body;
}
}
@@ -1,130 +0,0 @@
/**
* RabbitmqProperties.java
* Created at 2017-05-23
* Created by Administrator
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq;
import org.itkk.udf.amqp.rabbitmq.meta.ConsumerMeta;
import org.itkk.udf.amqp.rabbitmq.meta.ProducerMeta;
import org.itkk.udf.amqp.rabbitmq.meta.PublisherMeta;
import org.itkk.udf.amqp.rabbitmq.meta.SubscriberMeta;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.io.Serializable;
import java.util.Map;
/**
* 描述 : RabbitmqProperties
*
* @author Administrator
*/
@Component
@ConfigurationProperties(prefix = "org.itkk.rabbitmq.properties")
public class RabbitmqProperties implements Serializable {
/**
* 描述 : 死信后缀
*/
public static final String DEAD_LETTER_SUFFIX = ".dlx";
/**
* 描述 : ID
*/
private static final long serialVersionUID = 1L;
/**
* 描述 : 发布者 ( key:应用名称 )
*/
private Map<String, PublisherMeta> publisher;
/**
* 描述 : 订阅者 ( key:应用名称 )
*/
private Map<String, SubscriberMeta> subscriber;
/**
* 描述 : 生产者 ( key:编号 )
*/
private Map<String, ProducerMeta> producer;
/**
* 描述 : 消费者 ( key:编号 )
*/
private Map<String, ConsumerMeta> consumer;
/**
* 描述 : 获取publisher
*
* @return the publisher
*/
public Map<String, PublisherMeta> getPublisher() {
return publisher;
}
/**
* 描述 : 设置publisher
*
* @param publisher the publisher to set
*/
public void setPublisher(Map<String, PublisherMeta> publisher) {
this.publisher = publisher;
}
/**
* 描述 : 获取subscriber
*
* @return the subscriber
*/
public Map<String, SubscriberMeta> getSubscriber() {
return subscriber;
}
/**
* 描述 : 设置subscriber
*
* @param subscriber the subscriber to set
*/
public void setSubscriber(Map<String, SubscriberMeta> subscriber) {
this.subscriber = subscriber;
}
/**
* 描述 : 获取producer
*
* @return the producer
*/
public Map<String, ProducerMeta> getProducer() {
return producer;
}
/**
* 描述 : 设置producer
*
* @param producer the producer to set
*/
public void setProducer(Map<String, ProducerMeta> producer) {
this.producer = producer;
}
/**
* 描述 : 获取consumer
*
* @return the consumer
*/
public Map<String, ConsumerMeta> getConsumer() {
return consumer;
}
/**
* 描述 : 设置consumer
*
* @param consumer the consumer to set
*/
public void setConsumer(Map<String, ConsumerMeta> consumer) {
this.consumer = consumer;
}
}
@@ -1,92 +0,0 @@
/**
* ConsumerMeta.java
* Created at 2017-05-23
* Created by Administrator
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq.meta;
import java.io.Serializable;
/**
* 描述 : ConsumerMeta
*
* @author Administrator
*/
public class ConsumerMeta implements Serializable {
/**
* 描述 : ID
*/
private static final long serialVersionUID = 1L;
/**
* 描述 : 应用名称
*/
private String owner;
/**
* 描述 : 生产者
*/
private String producer;
/**
* 描述 : 描述
*/
private String description;
/**
* 描述 : 获取owner
*
* @return the owner
*/
public String getOwner() {
return owner;
}
/**
* 描述 : 设置owner
*
* @param owner the owner to set
*/
public void setOwner(String owner) {
this.owner = owner;
}
/**
* 描述 : 获取producer
*
* @return the producer
*/
public String getProducer() {
return producer;
}
/**
* 描述 : 设置producer
*
* @param producer the producer to set
*/
public void setProducer(String producer) {
this.producer = producer;
}
/**
* 描述 : 获取description
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* 描述 : 设置description
*
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
}
@@ -1,115 +0,0 @@
/**
* ProducerMeta.java
* Created at 2017-05-23
* Created by Administrator
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq.meta;
import java.io.Serializable;
/**
* 描述 : ProducerMeta
*
* @author Administrator
*/
public class ProducerMeta implements Serializable {
/**
* 描述 : ID
*/
private static final long serialVersionUID = 1L;
/**
* 描述 : 应用名称
*/
private String owner;
/**
* 描述 : 交换机
*/
private String exchange;
/**
* 描述 : 路由键
*/
private String routingKey;
/**
* 描述 : 描述
*/
private String description;
/**
* 描述 : 获取owner
*
* @return the owner
*/
public String getOwner() {
return owner;
}
/**
* 描述 : 设置owner
*
* @param owner the owner to set
*/
public void setOwner(String owner) {
this.owner = owner;
}
/**
* 描述 : 获取exchange
*
* @return the exchange
*/
public String getExchange() {
return exchange;
}
/**
* 描述 : 设置exchange
*
* @param exchange the exchange to set
*/
public void setExchange(String exchange) {
this.exchange = exchange;
}
/**
* 描述 : 获取routingKey
*
* @return the routingKey
*/
public String getRoutingKey() {
return routingKey;
}
/**
* 描述 : 设置routingKey
*
* @param routingKey the routingKey to set
*/
public void setRoutingKey(String routingKey) {
this.routingKey = routingKey;
}
/**
* 描述 : 获取description
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* 描述 : 设置description
*
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
}
@@ -1,63 +0,0 @@
package org.itkk.udf.amqp.rabbitmq.meta;
import java.io.Serializable;
/**
* 描述 : PublisherMeta
*
* @author Administrator
*/
public class PublisherMeta implements Serializable { //NOSONAR
/**
* 描述 : ID
*/
private static final long serialVersionUID = 1L;
/**
* 描述 : 权限列表
*/
private String purview;
/**
* 描述 : 描述
*/
private String description;
/**
* 描述 : 获取purview
*
* @return the purview
*/
public String getPurview() {
return purview;
}
/**
* 描述 : 设置purview
*
* @param purview the purview to set
*/
public void setPurview(String purview) {
this.purview = purview;
}
/**
* 描述 : 获取description
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* 描述 : 设置description
*
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
}
@@ -1,63 +0,0 @@
package org.itkk.udf.amqp.rabbitmq.meta;
import java.io.Serializable;
/**
* 描述 : SubscriberMeta
*
* @author Administrator
*/
public class SubscriberMeta implements Serializable { //NOSONAR
/**
* 描述 : ID
*/
private static final long serialVersionUID = 1L;
/**
* 描述 : 权限列表
*/
private String purview;
/**
* 描述 : 描述
*/
private String description;
/**
* 描述 : 获取purview
*
* @return the purview
*/
public String getPurview() {
return purview;
}
/**
* 描述 : 设置purview
*
* @param purview the purview to set
*/
public void setPurview(String purview) {
this.purview = purview;
}
/**
* 描述 : 获取description
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* 描述 : 设置description
*
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
}
@@ -1,43 +0,0 @@
/**
* RabbitmqController.java
* Created at 2017-05-25
* Created by Administrator
* Copyright (C) 2016 itkk.org, All rights reserved.
*/
package org.itkk.udf.amqp.rabbitmq.web;
import org.itkk.udf.amqp.rabbitmq.RabbitmqProperties;
import org.itkk.udf.core.RestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
/**
* 描述 : RabbitmqController
*
* @author Administrator
*/
@ApiIgnore
@RestController
@RequestMapping("rabbitmq")
public class RabbitmqController {
/**
* 描述 : rabbitmqProperties
*/
@Autowired(required = false)
private RabbitmqProperties rabbitmqProperties;
/**
* 描述 : 返回rabbitmq配置
*
* @return rabbitmq配置
*/
@RequestMapping(value = "properties", method = RequestMethod.GET)
public RestResponse<RabbitmqProperties> getProperties() {
return new RestResponse<>(rabbitmqProperties);
}
}