1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| package com.karoy.springboot.action;
import com.karoy.springboot.common.ApiResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.karoy.springboot.config.RabbitMQConfig;
@Api(description = "HELLO接口") @RestController public class HelloController { @Autowired private AmqpTemplate amqpTemplate;
@ApiOperation(value = "欢迎" , notes="欢迎") @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ApiResult.class), @ApiResponse(code = 204, message = "No Content", response = ApiResult.class), @ApiResponse(code = 401, message = "Unauthorized", response = ApiResult.class), @ApiResponse(code = 403, message = "Forbidden", response = ApiResult.class), @ApiResponse(code = 404, message = "Not Found", response = ApiResult.class) }) @RequestMapping("/hello") public String hello(@RequestParam("name") String name) {
amqpTemplate.convertAndSend(RabbitMQConfig.queueName, name);
return "Hello "+name; } }
|