-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
139 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
mq-client/src/main/java/cn/ipman/mq/client/config/MQClientBootstrapConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package cn.ipman.mq.client.config; | ||
|
||
import cn.ipman.mq.client.broker.MQBroker; | ||
import cn.ipman.mq.client.broker.MQListenerContainerFactory; | ||
import cn.ipman.mq.client.broker.MQProducer; | ||
import cn.ipman.mq.client.client.ClientService; | ||
import cn.ipman.mq.client.client.netty.NettyClientImpl; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
|
||
/** | ||
* Description for this class | ||
* | ||
* @Author IpMan | ||
* @Date 2024/7/14 08:47 | ||
*/ | ||
@Configuration | ||
@Import({MQConfigProperties.class}) | ||
public class MQClientBootstrapConfig { | ||
|
||
@Autowired | ||
private MQConfigProperties mqConfigProperties; | ||
|
||
@Bean | ||
public ClientService clientService() { | ||
return new NettyClientImpl( | ||
mqConfigProperties.getHost(), | ||
mqConfigProperties.getPort(), | ||
mqConfigProperties.getPoolMaxTotal(), | ||
mqConfigProperties.getPoolMaxIdle(), | ||
mqConfigProperties.getPoolMinIdle() | ||
); | ||
} | ||
|
||
@Bean(initMethod = "init") | ||
public MQBroker brokerFactory(@Autowired ClientService clientService) { | ||
return new MQBroker(clientService); | ||
} | ||
|
||
@Bean | ||
public MQProducer producerFactory(@Autowired MQBroker broker) { | ||
return broker.createProducer(); | ||
} | ||
|
||
@Bean | ||
public MQListenerContainerFactory listenerContainerFactory(@Autowired MQBroker broker) { | ||
return new MQListenerContainerFactory(broker); | ||
} | ||
|
||
} |
37 changes: 0 additions & 37 deletions
37
mq-client/src/main/java/cn/ipman/mq/client/config/MQClientConfig.java
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
mq-client/src/main/java/cn/ipman/mq/client/config/MQConfigProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cn.ipman.mq.client.config; | ||
|
||
import lombok.Data; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* Description for this class | ||
* | ||
* @Author IpMan | ||
* @Date 2024/7/14 10:21 | ||
*/ | ||
|
||
@Data | ||
@Configuration | ||
@ConfigurationProperties(prefix = "mq.client") | ||
public class MQConfigProperties { | ||
|
||
private String host = "127.0.0.1"; | ||
private int port = 8765; | ||
private int poolMaxTotal = 10; | ||
private int poolMaxIdle = 5; | ||
private int poolMinIdle = 2; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.