001/** 002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package io.jboot.components.mq; 017 018import com.google.common.collect.Sets; 019import io.jboot.app.config.annotation.ConfigModel; 020import io.jboot.utils.StrUtil; 021 022import java.util.Set; 023 024 025@ConfigModel(prefix = "jboot.mq") 026public class JbootmqConfig { 027 public static final String TYPE_REDIS = "redis"; 028 public static final String TYPE_ACTIVEMQ = "activemq"; 029 public static final String TYPE_ALIYUNMQ = "aliyunmq"; 030 public static final String TYPE_RABBITMQ = "rabbitmq"; 031 public static final String TYPE_ROCKETMQ = "rocketmq"; 032 public static final String TYPE_QPID = "qpid"; 033 public static final String TYPE_LOCAL = "local"; 034 035 public static final Set<String> TYPES = Sets.newHashSet(TYPE_REDIS, TYPE_ACTIVEMQ, TYPE_ALIYUNMQ, TYPE_RABBITMQ 036 , TYPE_ROCKETMQ, TYPE_QPID, TYPE_LOCAL); 037 038 039 private String name = "default"; // MQ 的名称,可以配置多个 MQ 实例,但是需要名称不能一样 040 private String type; // MQ 的类型: redis、rocketmq 等 041 private String typeName; // MQ 相同的类型,可能有多一个实例,比如两个 redis,此时需要配置实例的名称 042 private String channel; // 发送的通道,或者是 topic,多个用英文逗号二开 043 private String syncRecevieMessageChannel; //可同步接收消息的 channel 配置 044 private String serializer; // MQ 默认的序列化方案 045 046 public String getName() { 047 return name; 048 } 049 050 public void setName(String name) { 051 this.name = name; 052 } 053 054 public String getType() { 055 return type; 056 } 057 058 public void setType(String type) { 059 this.type = type; 060 } 061 062 public String getTypeName() { 063 return typeName; 064 } 065 066 public void setTypeName(String typeName) { 067 this.typeName = typeName; 068 } 069 070 public String getChannel() { 071 return channel; 072 } 073 074 public void setChannel(String channel) { 075 this.channel = channel; 076 } 077 078 public String getSyncRecevieMessageChannel() { 079 return syncRecevieMessageChannel; 080 } 081 082 public void setSyncRecevieMessageChannel(String syncRecevieMessageChannel) { 083 this.syncRecevieMessageChannel = syncRecevieMessageChannel; 084 } 085 086 public String getSerializer() { 087 return serializer; 088 } 089 090 public void setSerializer(String serializer) { 091 this.serializer = serializer; 092 } 093 094 public boolean isConfigOk() { 095 return StrUtil.isNotEmpty(type); 096 } 097}