What are the six working modes of rabbitmq? How to integrate rabbitmq with springboot

itread01 2021-01-23 14:21:45
working modes rabbitmq integrate rabbitmq


Catalog

  • One 、RabbitMQ Introduction Program
  • Two 、Work queues Working mode
  • 3、 ... and 、Publish / Subscribe waive / Subscription mode
  • Four 、Routing Routing mode
  • 5、 ... and 、Topics
  • 6、 ... and 、Header
  • 7、 ... and 、RPC
  • 8、 ... and 、Spring Data Elasticsearch

One 、RabbitMQ Introduction Program

<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </dependency></dependencies>

application.yml

server: port: 44000spring: application: name: test-rabbitmq-producer rabbitmq: username: guest password: guest host: 127.0.0.1 port: 5672 virtual-host: /

The sender of the message

/** * Description: rabbitmq Introduction Program * * @author zygui * @date Created on 2020/5/13 15:34 */public class Producer01 { // Declare a message queue name private static final String QUEUE_NAME = "helloworld"; public static void main(String[] args) { // Create new connections with... Through the connection factory mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672); connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // The default is / that will do // Establish a connection Connection connection = null; // Establish a channel ( The purpose is to reuse the connection ) Channel channel = null; try { // Create new connections connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel channel = connection.createChannel(); // Announcement queue , If the queue is in mq If you don't have it, you have to build // Arguments :String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_NAME,true,false,false,null); // Send a message // Arguments :String exchange, String routingKey, BasicProperties props, byte[] body /** * Argument details : * 1、exchange, Switch , If not specified... Will be used mq The default switch ( Set to "") * 2、routingKey, route key, Switch according to route key To forward messages to the specified queue , If you use a preset switch ,routingKey Set to the name of the queue * 3、props, The properties of the message * 4、body, Message content */ // Message content String message = "hello world Guichaoyang "; channel.basicPublish("",QUEUE_NAME,null,message.getBytes()); System.out.println("send to mq "+message); } catch (Exception e) { e.printStackTrace(); } finally { try { // Close channel channel.close(); // Close connection connection.close(); } catch (Exception e) { e.printStackTrace(); } } }}

The recipient of the message

/** * Description: rabbitmq Introduction Program * * @author zygui * @date Created on 2020/5/13 15:45 */public class Consumer01 { private static final String QUEUE_NAME = "helloworld"; public static void main(String[] args) throws IOException, TimeoutException { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // Create new connections Connection connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel Channel channel = connection.createChannel(); // Listen to the queue // Announcement queue , If the queue is in mq If you don't have it, you have to build // Arguments :String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_NAME,true,false,false,null); // How to achieve consumption DefaultConsumer defaultConsumer = new DefaultConsumer(channel) { /** * When a message is received, this method will be called * @param consumerTag Consumer labels , Used to identify consumers , Set... When listening to a queue channel.basicConsume * @param envelope The envelope , Through envelope * @param properties Message properties * @param body Message content * @throws IOException */ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Switch String exchange = envelope.getExchange(); // Message id,mq stay channel Used to identify messages in id, Can be used to confirm that a message has been received long deliveryTag = envelope.getDeliveryTag(); // Message content String message= new String(body,"utf-8"); System.out.println("receive message:"+message); } }; // Listen to the queue // Arguments :String queue, boolean autoAck, Consumer callback /** * Argument details : * 1、queue Queue name * 2、autoAck Automatic reply , When consumers receive a message, they should tell mq Message received , If you set this argument to tru It means that it will reply automatically mq, If set to false It is necessary to realize reply through programming * 3、callback, Consumption method , When a consumer receives a message, the method to be executed */ channel.basicConsume(QUEUE_NAME,true,defaultConsumer); }}

The entry program steps

Two 、Work queues Working mode


3、 ... and 、Publish / Subscribe waive / Subscription mode


Information producers

public class Producer02_publish { // Queue name private static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; private static final String QUEUE_INFORM_SMS = "queue_inform_sms"; // Switch name private static final String EXCHANGE_FANOUT_INFORM="exchange_fanout_inform"; public static void main(String[] args) { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); Connection connection = null; Channel channel = null; try { // Create new connections connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel channel = connection.createChannel(); // Announcement queue , If the queue is in mq If you don't have it, you have to build // Arguments :String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_EMAIL,true,false,false,null); channel.queueDeclare(QUEUE_INFORM_SMS,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_FANOUT_INFORM, BuiltinExchangeType.FANOUT); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_EMAIL,EXCHANGE_FANOUT_INFORM,""); channel.queueBind(QUEUE_INFORM_SMS,EXCHANGE_FANOUT_INFORM,""); // Send a message // Arguments :String exchange, String routingKey, BasicProperties props, byte[] body /** * Argument details : * 1、exchange, Switch , If not specified... Will be used mq The default switch ( Set to "") * 2、routingKey, route key, Switch according to route key To forward messages to the specified queue , If you use a preset switch ,routingKey Set to the name of the queue * 3、props, The properties of the message * 4、body, Message content */ for(int i=0;i<5;i++){ // Message content String message = "send inform message to user"; channel.basicPublish(EXCHANGE_FANOUT_INFORM,"",null,message.getBytes()); System.out.println("send to mq "+message); } } catch (Exception e) { e.printStackTrace(); } finally { // Close connection // Close the channel first try { channel.close(); } catch (IOException e) { e.printStackTrace(); } catch (TimeoutException e) { e.printStackTrace(); } try { connection.close(); } catch (IOException e) { e.printStackTrace(); } } }}

The recipient of the message 1

public class Consumer02_subscribe_email { // Queue name private static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; private static final String EXCHANGE_FANOUT_INFORM="exchange_fanout_inform"; public static void main(String[] args) throws IOException, TimeoutException { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // Create new connections Connection connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel Channel channel = connection.createChannel(); /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_EMAIL,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_FANOUT_INFORM, BuiltinExchangeType.FANOUT); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_EMAIL, EXCHANGE_FANOUT_INFORM, ""); // How to achieve consumption DefaultConsumer defaultConsumer = new DefaultConsumer(channel){ /** * When a message is received, this method will be called * @param consumerTag Consumer labels , Used to identify consumers , Set... When listening to a queue channel.basicConsume * @param envelope The envelope , Through envelope * @param properties Message properties * @param body Message content * @throws IOException */ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Switch String exchange = envelope.getExchange(); // Message id,mq stay channel Used to identify messages in id, Can be used to confirm that a message has been received long deliveryTag = envelope.getDeliveryTag(); // Message content String message= new String(body,"utf-8"); System.out.println("receive message:"+message); } }; // Listen to the queue // Arguments :String queue, boolean autoAck, Consumer callback /** * Argument details : * 1、queue Queue name * 2、autoAck Automatic reply , When consumers receive a message, they should tell mq Message received , If you set this argument to tru It means that it will reply automatically mq, If set to false It is necessary to realize reply through programming * 3、callback, Consumption method , When a consumer receives a message, the method to be executed */ channel.basicConsume(QUEUE_INFORM_EMAIL,true,defaultConsumer); }}

The recipient of the message 2

public class Consumer02_subscribe_sms { // Queue name private static final String QUEUE_INFORM_SMS = "queue_inform_sms"; private static final String EXCHANGE_FANOUT_INFORM="exchange_fanout_inform"; public static void main(String[] args) throws IOException, TimeoutException { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // Create new connections Connection connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel Channel channel = connection.createChannel(); /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_SMS,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_FANOUT_INFORM, BuiltinExchangeType.FANOUT); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_SMS, EXCHANGE_FANOUT_INFORM, ""); // How to achieve consumption DefaultConsumer defaultConsumer = new DefaultConsumer(channel){ /** * When a message is received, this method will be called * @param consumerTag Consumer labels , Used to identify consumers , Set... When listening to a queue channel.basicConsume * @param envelope The envelope , Through envelope * @param properties Message properties * @param body Message content * @throws IOException */ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Switch String exchange = envelope.getExchange(); // Message id,mq stay channel Used to identify messages in id, Can be used to confirm that a message has been received long deliveryTag = envelope.getDeliveryTag(); // Message content String message= new String(body,"utf-8"); System.out.println("receive message:"+message); } }; // Listen to the queue // Arguments :String queue, boolean autoAck, Consumer callback /** * Argument details : * 1、queue Queue name * 2、autoAck Automatic reply , When consumers receive a message, they should tell mq Message received , If you set this argument to tru It means that it will reply automatically mq, If set to false It is necessary to realize reply through programming * 3、callback, Consumption method , When a consumer receives a message, the method to be executed */ channel.basicConsume(QUEUE_INFORM_SMS,true,defaultConsumer); }}

Four 、Routing Routing mode


Information producers

public class Producer03_routing { // Queue name private static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; private static final String QUEUE_INFORM_SMS = "queue_inform_sms"; // Switch name private static final String EXCHANGE_ROUTING_INFORM="exchange_routing_inform"; // Routing key name private static final String ROUTINGKEY_EMAIL="inform_email"; private static final String ROUTINGKEY_SMS="inform_sms"; public static void main(String[] args) { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); Connection connection = null; Channel channel = null; try { // Create new connections connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel channel = connection.createChannel(); // Announcement queue , If the queue is in mq If you don't have it, you have to build // Arguments :String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_EMAIL,true,false,false,null); channel.queueDeclare(QUEUE_INFORM_SMS,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_ROUTING_INFORM, BuiltinExchangeType.DIRECT); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_EMAIL,EXCHANGE_ROUTING_INFORM,ROUTINGKEY_EMAIL); //channel.queueBind(QUEUE_INFORM_EMAIL,EXCHANGE_ROUTING_INFORM,"inform"); channel.queueBind(QUEUE_INFORM_SMS,EXCHANGE_ROUTING_INFORM,ROUTINGKEY_SMS); //channel.queueBind(QUEUE_INFORM_SMS,EXCHANGE_ROUTING_INFORM,"inform"); // Send a message // Arguments :String exchange, String routingKey, BasicProperties props, byte[] body /** * Argument details : * 1、exchange, Switch , If not specified... Will be used mq The default switch ( Set to "") * 2、routingKey, route key, Switch according to route key To forward messages to the specified queue , If you use a preset switch ,routingKey Set to the name of the queue * 3、props, The properties of the message * 4、body, Message content */ /* for(int i=0;i<5;i++){ // When sending a message, specify routingKey String message = "send email inform message to user"; channel.basicPublish(EXCHANGE_ROUTING_INFORM,ROUTINGKEY_EMAIL,null,message.getBytes()); System.out.println("send to mq "+message); }*/ for(int i=0;i<5;i++){ // When sending a message, specify routingKey String message = "send sms inform message to user"; channel.basicPublish(EXCHANGE_ROUTING_INFORM,ROUTINGKEY_SMS,null,message.getBytes()); System.out.println("send to mq "+message); } // At this point, the specified routing key is inform, So both consumers can consume /*for(int i=0;i<5;i++){ // When sending a message, specify routingKey String message = "send inform message to user"; channel.basicPublish(EXCHANGE_ROUTING_INFORM,"inform",null,message.getBytes()); System.out.println("send to mq "+message); }*/ } catch (Exception e) { e.printStackTrace(); } finally { // Close connection // Close the channel first try { channel.close(); } catch (IOException e) { e.printStackTrace(); } catch (TimeoutException e) { e.printStackTrace(); } try { connection.close(); } catch (IOException e) { e.printStackTrace(); } } }}

The recipient of the message 1

public class Consumer03_routing_email { // Queue name private static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; // Switch name private static final String EXCHANGE_ROUTING_INFORM="exchange_routing_inform"; // Routing key name private static final String ROUTINGKEY_EMAIL="inform_email"; public static void main(String[] args) throws IOException, TimeoutException { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // Create new connections Connection connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel Channel channel = connection.createChannel(); /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_EMAIL,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_ROUTING_INFORM, BuiltinExchangeType.DIRECT); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_EMAIL, EXCHANGE_ROUTING_INFORM,ROUTINGKEY_EMAIL); // How to achieve consumption DefaultConsumer defaultConsumer = new DefaultConsumer(channel){ /** * When a message is received, this method will be called * @param consumerTag Consumer labels , Used to identify consumers , Set... When listening to a queue channel.basicConsume * @param envelope The envelope , Through envelope * @param properties Message properties * @param body Message content * @throws IOException */ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Switch String exchange = envelope.getExchange(); // Message id,mq stay channel Used to identify messages in id, Can be used to confirm that a message has been received long deliveryTag = envelope.getDeliveryTag(); // Message content String message= new String(body,"utf-8"); System.out.println("receive message:"+message); } }; // Listen to the queue // Arguments :String queue, boolean autoAck, Consumer callback /** * Argument details : * 1、queue Queue name * 2、autoAck Automatic reply , When consumers receive a message, they should tell mq Message received , If you set this argument to tru It means that it will reply automatically mq, If set to false It is necessary to realize reply through programming * 3、callback, Consumption method , When a consumer receives a message, the method to be executed */ channel.basicConsume(QUEUE_INFORM_EMAIL,true,defaultConsumer); }}
http://www.dtmao.cc/news_show_631033.shtml

The recipient of the message 2

public class Consumer03_routing_sms { // Queue name private static final String QUEUE_INFORM_SMS = "queue_inform_sms"; private static final String EXCHANGE_ROUTING_INFORM="exchange_routing_inform"; private static final String ROUTINGKEY_SMS="inform_sms"; public static void main(String[] args) throws IOException, TimeoutException { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // Create new connections Connection connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel Channel channel = connection.createChannel(); /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_SMS,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_ROUTING_INFORM, BuiltinExchangeType.DIRECT); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_SMS, EXCHANGE_ROUTING_INFORM,ROUTINGKEY_SMS); // How to achieve consumption DefaultConsumer defaultConsumer = new DefaultConsumer(channel){ /** * When a message is received, this method will be called * @param consumerTag Consumer labels , Used to identify consumers , Set... When listening to a queue channel.basicConsume * @param envelope The envelope , Through envelope * @param properties Message properties * @param body Message content * @throws IOException */ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Switch String exchange = envelope.getExchange(); // Message id,mq stay channel Used to identify messages in id, Can be used to confirm that a message has been received long deliveryTag = envelope.getDeliveryTag(); // Message content String message= new String(body,"utf-8"); System.out.println("receive message:"+message); } }; // Listen to the queue // Arguments :String queue, boolean autoAck, Consumer callback /** * Argument details : * 1、queue Queue name * 2、autoAck Automatic reply , When consumers receive a message, they should tell mq Message received , If you set this argument to tru It means that it will reply automatically mq, If set to false It is necessary to realize reply through programming * 3、callback, Consumption method , When a consumer receives a message, the method to be executed */ channel.basicConsume(QUEUE_INFORM_SMS,true,defaultConsumer); }}

5、 ... and 、Topics

public class Producer04_topics { // Queue name private static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; private static final String QUEUE_INFORM_SMS = "queue_inform_sms"; // Announce the switch private static final String EXCHANGE_TOPICS_INFORM="exchange_topics_inform"; // Use the way of the universal character to , Set the routing key private static final String ROUTINGKEY_EMAIL="inform.#.email.#"; private static final String ROUTINGKEY_SMS="inform.#.sms.#"; public static void main(String[] args) { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); Connection connection = null; Channel channel = null; try { // Create new connections connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel channel = connection.createChannel(); // Announcement queue , If the queue is in mq If you don't have it, you have to build // Arguments :String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_EMAIL,true,false,false,null); channel.queueDeclare(QUEUE_INFORM_SMS,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_TOPICS_INFORM, BuiltinExchangeType.TOPIC); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_EMAIL,EXCHANGE_TOPICS_INFORM,ROUTINGKEY_EMAIL); channel.queueBind(QUEUE_INFORM_SMS,EXCHANGE_TOPICS_INFORM,ROUTINGKEY_SMS); // Send a message // Arguments :String exchange, String routingKey, BasicProperties props, byte[] body /** * Argument details : * 1、exchange, Switch , If not specified... Will be used mq The default switch ( Set to "") * 2、routingKey, route key, Switch according to route key To forward messages to the specified queue , If you use a preset switch ,routingKey Set to the name of the queue * 3、props, The properties of the message * 4、body, Message content */ for(int i=0;i<5;i++){ // When sending a message, specify routingKey String message = "send email inform message to user"; channel.basicPublish(EXCHANGE_TOPICS_INFORM,"inform.email",null,message.getBytes()); System.out.println("send to mq "+message); } for(int i=0;i<5;i++){ // When sending a message, specify routingKey String message = "send sms inform message to user"; channel.basicPublish(EXCHANGE_TOPICS_INFORM,"inform.sms",null,message.getBytes()); System.out.println("send to mq "+message); } for(int i=0;i<5;i++){ // When sending a message, specify routingKey String message = "send sms and email inform message to user"; channel.basicPublish(EXCHANGE_TOPICS_INFORM,"inform.sms.email",null,message.getBytes()); System.out.println("send to mq "+message); } } catch (Exception e) { e.printStackTrace(); } finally { // Close connection // Close the channel first try { channel.close(); } catch (IOException e) { e.printStackTrace(); } catch (TimeoutException e) { e.printStackTrace(); } try { connection.close(); } catch (IOException e) { e.printStackTrace(); } } }}

The recipient of the message 1

public class Consumer04_topics_email { // Queue name private static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; private static final String EXCHANGE_TOPICS_INFORM="exchange_topics_inform"; private static final String ROUTINGKEY_EMAIL="inform.#.email.#"; public static void main(String[] args) throws IOException, TimeoutException { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // Create new connections Connection connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel Channel channel = connection.createChannel(); /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_EMAIL,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_TOPICS_INFORM, BuiltinExchangeType.TOPIC); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_EMAIL, EXCHANGE_TOPICS_INFORM,ROUTINGKEY_EMAIL); // How to achieve consumption DefaultConsumer defaultConsumer = new DefaultConsumer(channel){ /** * When a message is received, this method will be called * @param consumerTag Consumer labels , Used to identify consumers , Set... When listening to a queue channel.basicConsume * @param envelope The envelope , Through envelope * @param properties Message properties * @param body Message content * @throws IOException */ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Switch String exchange = envelope.getExchange(); // Message id,mq stay channel Used to identify messages in id, Can be used to confirm that a message has been received long deliveryTag = envelope.getDeliveryTag(); // Message content String message= new String(body,"utf-8"); System.out.println("receive message:"+message); } }; // Listen to the queue // Arguments :String queue, boolean autoAck, Consumer callback /** * Argument details : * 1、queue Queue name * 2、autoAck Automatic reply , When consumers receive a message, they should tell mq Message received , If you set this argument to tru It means that it will reply automatically mq, If set to false It is necessary to realize reply through programming * 3、callback, Consumption method , When a consumer receives a message, the method to be executed */ channel.basicConsume(QUEUE_INFORM_EMAIL,true,defaultConsumer); }}

Lowercase recipients 2

public class Consumer04_topics_sms { // Queue name private static final String QUEUE_INFORM_SMS = "queue_inform_sms"; private static final String EXCHANGE_TOPICS_INFORM="exchange_topics_inform"; private static final String ROUTINGKEY_SMS="inform.#.sms.#"; public static void main(String[] args) throws IOException, TimeoutException { // Create new connections and mq Establish a connection ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("127.0.0.1"); connectionFactory.setPort(5672);// Port connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); // Set up the virtual machine , One mq Services can set up multiple virtual machines , Each virtual machine is equivalent to an independent mq connectionFactory.setVirtualHost("/"); // Create new connections Connection connection = connectionFactory.newConnection(); // Set up a session channel , Producers and mq Service, all communications are in channel Done in the channel Channel channel = connection.createChannel(); /** * Argument details * 1、queue Queue name * 2、durable Persistent or not , If you persist ,mq The queue is still running after restart * 3、exclusive Exclusive connection or not , Queues are only allowed to be accessed on this connection , If connection When the connection is closed, the queue will be deleted automatically , If you set this argument to true Can be used to create temporary queues * 4、autoDelete Automatically delete , Automatically delete the queue when it is no longer in use , If this argument and exclusive The argument is set to true The temporary queue can be realized ( Queues are automatically deleted when they are not used ) * 5、arguments Arguments , You can set the extension suite arguments of a queue , such as : The survival time can be set */ channel.queueDeclare(QUEUE_INFORM_SMS,true,false,false,null); // Announce a switch // Arguments :String exchange, String type /** * Argument details : * 1、 The name of the switch * 2、 Type of switch * fanout: Corresponding rabbitmq The working mode of publish/subscribe * direct: Corresponding Routing Working mode * topic: Corresponding Topics Working mode * headers: Corresponding headers Working mode */ channel.exchangeDeclare(EXCHANGE_TOPICS_INFORM, BuiltinExchangeType.TOPIC); // Switch and queue binding // Arguments :String queue, String exchange, String routingKey /** * Argument details : * 1、queue Queue name * 2、exchange Switch name * 3、routingKey route key, The function of the switch is based on routing key Forward the message to the specified queue , In release subscription mode, coordination is an empty string */ channel.queueBind(QUEUE_INFORM_SMS, EXCHANGE_TOPICS_INFORM,ROUTINGKEY_SMS); // How to achieve consumption DefaultConsumer defaultConsumer = new DefaultConsumer(channel){ /** * When a message is received, this method will be called * @param consumerTag Consumer labels , Used to identify consumers , Set... When listening to a queue channel.basicConsume * @param envelope The envelope , Through envelope * @param properties Message properties * @param body Message content * @throws IOException */ @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { // Switch String exchange = envelope.getExchange(); // Message id,mq stay channel Used to identify messages in id, Can be used to confirm that a message has been received long deliveryTag = envelope.getDeliveryTag(); // Message content String message= new String(body,"utf-8"); System.out.println("receive message:"+message); } }; // Listen to the queue // Arguments :String queue, boolean autoAck, Consumer callback /** * Argument details : * 1、queue Queue name * 2、autoAck Automatic reply , When consumers receive a message, they should tell mq Message received , If you set this argument to tru It means that it will reply automatically mq, If set to false It is necessary to realize reply through programming * 3、callback, Consumption method , When a consumer receives a message, the method to be executed */ channel.basicConsume(QUEUE_INFORM_SMS,true,defaultConsumer); }}

6、 ... and 、Header

7、 ... and 、RPC

8、 ... and 、Spring Data Elasticsearch

rabbitmq-producer The sender of the message

@Configurationpublic class RabbitMQConfig { // Declare two queue constants public static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; public static final String QUEUE_INFORM_SMS = "queue_inform_sms"; // Declare switch constants public static final String EXCHANGE_TOPICS_INFORM="exchange_topics_inform"; // Declare two routing key constants public static final String ROUTINGKEY_EMAIL="inform.#.email.#"; public static final String ROUTINGKEY_SMS="inform.#.sms.#"; // Announce the switch @Bean(EXCHANGE_TOPICS_INFORM) public Exchange EXCHANGE_TOPICS_INFORM(){ //durable(true) Persistence ,mq The switch is still running after restart return ExchangeBuilder.topicExchange(EXCHANGE_TOPICS_INFORM).durable(true).build(); } // Announcement queue // Declare QUEUE_INFORM_EMAIL Waiting for @Bean(QUEUE_INFORM_EMAIL) public Queue QUEUE_INFORM_EMAIL(){ return new Queue(QUEUE_INFORM_EMAIL); } // Declare QUEUE_INFORM_SMS Waiting for @Bean(QUEUE_INFORM_SMS) public Queue QUEUE_INFORM_SMS(){ return new Queue(QUEUE_INFORM_SMS); } // Bind switches and queues //ROUTINGKEY_EMAIL Queue bound switch , Appoint routingKey @Bean public Binding BINDING_QUEUE_INFORM_EMAIL(@Qualifier(QUEUE_INFORM_EMAIL) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange){ return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_EMAIL).noargs(); } //ROUTINGKEY_SMS Queue bound switch , Appoint routingKey @Bean public Binding BINDING_ROUTINGKEY_SMS(@Qualifier(QUEUE_INFORM_SMS) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange){ return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_SMS).noargs(); }}

rabbitmq-consumer The recipient of the message

@Configurationpublic class RabbitMQConfig { public static final String QUEUE_INFORM_EMAIL = "queue_inform_email"; public static final String QUEUE_INFORM_SMS = "queue_inform_sms"; public static final String EXCHANGE_TOPICS_INFORM="exchange_topics_inform"; public static final String ROUTINGKEY_EMAIL="inform.#.email.#"; public static final String ROUTINGKEY_SMS="inform.#.sms.#"; // Announce the switch @Bean(EXCHANGE_TOPICS_INFORM) public Exchange EXCHANGE_TOPICS_INFORM(){ //durable(true) Persistence ,mq The switch is still running after restart return ExchangeBuilder.topicExchange(EXCHANGE_TOPICS_INFORM).durable(true).build(); } // Announcement queue // Declare QUEUE_INFORM_EMAIL Waiting for @Bean(QUEUE_INFORM_EMAIL) public Queue QUEUE_INFORM_EMAIL(){ return new Queue(QUEUE_INFORM_EMAIL); } // Declare QUEUE_INFORM_SMS Waiting for @Bean(QUEUE_INFORM_SMS) public Queue QUEUE_INFORM_SMS(){ return new Queue(QUEUE_INFORM_SMS); } // Bind switches and queues //ROUTINGKEY_EMAIL Queue bound switch , Appoint routingKey @Bean public Binding BINDING_QUEUE_INFORM_EMAIL(@Qualifier(QUEUE_INFORM_EMAIL) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange){ return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_EMAIL).noargs(); } //ROUTINGKEY_SMS Queue bound switch , Appoint routingKey @Bean public Binding BINDING_ROUTINGKEY_SMS(@Qualifier(QUEUE_INFORM_SMS) Queue queue, @Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange){ return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_SMS).noargs(); }}
@SpringBootApplication@EnableRabbitpublic class TestRabbitMQApplication { public static void main(String[] args) { SpringApplication.run(TestRabbitMQApplication.class, args); }}

Listen on message queue

@Componentpublic class ReceiveHandler { @RabbitListener(queues = {RabbitMQConfig.QUEUE_INFORM_EMAIL}) public void receiveMsg(String msg) { System.out.println(" The message received is = " + msg); }}

stay rabbitmq-provider Middle test

@SpringBootTest@RunWith(SpringRunner.class)public class Producer05_topics_springboot { // Use rabbitTemplate Send a message @Autowired private RabbitTemplate rabbitTemplate; @Test public void testSendEmail() { String message = "send email message to user"; /** * arg1: Switch name * arg2: Routing key * arg3: Message content */ rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_TOPICS_INFORM, "inform.email", message); }}

 
版权声明
本文为[itread01]所创,转载请带上原文链接,感谢
https://javamana.com/2021/01/20210123141959945V.html

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云