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.rabbitmq; 017 018import io.jboot.app.config.annotation.ConfigModel; 019 020 021@ConfigModel(prefix = "jboot.mq.rabbitmq") 022public class JbootRabbitmqConfig { 023 024 025 /** 026 * 默认 username 为 guest 027 */ 028 private String username; 029 030 /** 031 * 默认密码为 guest 032 */ 033 private String password; 034 035 private String host = "127.0.0.1"; 036 private int port = 5672; 037 private String virtualHost; 038 039 private String broadcastChannelPrefix = "broadcast-"; 040 private String broadcastChannelRoutingKey = ""; 041 042 //若配置为 false,则需要在 OnMessage 里,调用 MessageContext.getChannel().baseAck(或者baseNack)进行消费(或者标识消费失败) 043 private boolean autoAck = true; 044 045 // 默认开启队列 046 private boolean queueEnable = true; 047 private boolean queueDeclareDurable = false; 048 private boolean queueDeclareExclusive = false; 049 private boolean queueDeclareAutoDelete = false; 050 051 052 // 默认开启广播模式 053 private boolean broadcastEnable = true; 054 055 private String broadcastExchangeDeclareExchangeType = "fanout"; 056 private boolean broadcastExchangeDeclareDurable = false; 057 058 private boolean broadcastQueueDeclareDurable = false; 059 private boolean broadcastQueueDeclareExclusive = false; 060 private boolean broadcastQueueDeclareAutoDelete = true; 061 062 public String getUsername() { 063 return username; 064 } 065 066 public void setUsername(String username) { 067 this.username = username; 068 } 069 070 public String getPassword() { 071 return password; 072 } 073 074 public void setPassword(String password) { 075 this.password = password; 076 } 077 078 public String getHost() { 079 return host; 080 } 081 082 public void setHost(String host) { 083 this.host = host; 084 } 085 086 public int getPort() { 087 return port; 088 } 089 090 public void setPort(int port) { 091 this.port = port; 092 } 093 094 public String getVirtualHost() { 095 return virtualHost; 096 } 097 098 public void setVirtualHost(String virtualHost) { 099 this.virtualHost = virtualHost; 100 } 101 102 public String getBroadcastChannelPrefix() { 103 return broadcastChannelPrefix; 104 } 105 106 public void setBroadcastChannelPrefix(String broadcastChannelPrefix) { 107 this.broadcastChannelPrefix = broadcastChannelPrefix; 108 } 109 110 public String getBroadcastChannelRoutingKey() { 111 return broadcastChannelRoutingKey; 112 } 113 114 public void setBroadcastChannelRoutingKey(String broadcastChannelRoutingKey) { 115 this.broadcastChannelRoutingKey = broadcastChannelRoutingKey; 116 } 117 118 public boolean isAutoAck() { 119 return autoAck; 120 } 121 122 public void setAutoAck(boolean autoAck) { 123 this.autoAck = autoAck; 124 } 125 126 public boolean isQueueDeclareDurable() { 127 return queueDeclareDurable; 128 } 129 130 public void setQueueDeclareDurable(boolean queueDeclareDurable) { 131 this.queueDeclareDurable = queueDeclareDurable; 132 } 133 134 public boolean isQueueDeclareExclusive() { 135 return queueDeclareExclusive; 136 } 137 138 public void setQueueDeclareExclusive(boolean queueDeclareExclusive) { 139 this.queueDeclareExclusive = queueDeclareExclusive; 140 } 141 142 public boolean isQueueDeclareAutoDelete() { 143 return queueDeclareAutoDelete; 144 } 145 146 public void setQueueDeclareAutoDelete(boolean queueDeclareAutoDelete) { 147 this.queueDeclareAutoDelete = queueDeclareAutoDelete; 148 } 149 150 public String getBroadcastExchangeDeclareExchangeType() { 151 return broadcastExchangeDeclareExchangeType; 152 } 153 154 public void setBroadcastExchangeDeclareExchangeType(String broadcastExchangeDeclareExchangeType) { 155 this.broadcastExchangeDeclareExchangeType = broadcastExchangeDeclareExchangeType; 156 } 157 158 public boolean isBroadcastExchangeDeclareDurable() { 159 return broadcastExchangeDeclareDurable; 160 } 161 162 public void setBroadcastExchangeDeclareDurable(boolean broadcastExchangeDeclareDurable) { 163 this.broadcastExchangeDeclareDurable = broadcastExchangeDeclareDurable; 164 } 165 166 public boolean isBroadcastQueueDeclareDurable() { 167 return broadcastQueueDeclareDurable; 168 } 169 170 public void setBroadcastQueueDeclareDurable(boolean broadcastQueueDeclareDurable) { 171 this.broadcastQueueDeclareDurable = broadcastQueueDeclareDurable; 172 } 173 174 public boolean isBroadcastQueueDeclareExclusive() { 175 return broadcastQueueDeclareExclusive; 176 } 177 178 public void setBroadcastQueueDeclareExclusive(boolean broadcastQueueDeclareExclusive) { 179 this.broadcastQueueDeclareExclusive = broadcastQueueDeclareExclusive; 180 } 181 182 public boolean isBroadcastQueueDeclareAutoDelete() { 183 return broadcastQueueDeclareAutoDelete; 184 } 185 186 public void setBroadcastQueueDeclareAutoDelete(boolean broadcastQueueDeclareAutoDelete) { 187 this.broadcastQueueDeclareAutoDelete = broadcastQueueDeclareAutoDelete; 188 } 189 190 public boolean isQueueEnable() { 191 return queueEnable; 192 } 193 194 public void setQueueEnable(boolean queueEnable) { 195 this.queueEnable = queueEnable; 196 } 197 198 public boolean isBroadcastEnable() { 199 return broadcastEnable; 200 } 201 202 public void setBroadcastEnable(boolean broadcastEnable) { 203 this.broadcastEnable = broadcastEnable; 204 } 205}