org.springframework.amqp.core.AmqpTemplate Java Examples

The following examples show how to use org.springframework.amqp.core.AmqpTemplate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoConfiguration.java    From open-cloud with MIT License 5 votes vote down vote up
/**
 * 自定义注解扫描
 *
 * @return
 */
@Bean
@ConditionalOnMissingBean(RequestMappingScan.class)
public RequestMappingScan resourceAnnotationScan(AmqpTemplate amqpTemplate, OpenScanProperties scanProperties) {
    RequestMappingScan scan = new RequestMappingScan(amqpTemplate,scanProperties);
    log.info("RequestMappingScan [{}]", scan);
    return scan;
}
 
Example #2
Source File: RankListener.java    From sentiment-analysis-twitter-microservices-example with Apache License 2.0 5 votes vote down vote up
@Autowired
public RankListener(ObjectMapper objectMapper, AmqpTemplate amqpTemplate, Twitter twitter,
                    FollowsRepository followsRepository, TwitterService twitterService,
                    UserRepository userRepository) {
    this.objectMapper = objectMapper;
    this.amqpTemplate = amqpTemplate;
    this.twitter = twitter;
    this.followsRepository = followsRepository;
    this.twitterService = twitterService;
    this.userRepository = userRepository;
}
 
Example #3
Source File: ProducerMain.java    From Project with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  
  ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/amqp-producer.xml");
  AmqpTemplate template = (AmqpTemplate) context.getBean("rabbitTemplate");
  
  for (int i=0; i < 20; i++) {
    System.out.println("Sending message #" + i);
    Spittle spittle = new Spittle((long) i, null, "Hello world (" + i + ")", new Date());
    template.convertAndSend(spittle);
    Thread.sleep(5000);
  }
  
  System.out.println("Done!");
  
}
 
Example #4
Source File: SpringRabbitMQTest.java    From java-specialagent with Apache License 2.0 5 votes vote down vote up
@Test
public void test(final MockTracer tracer) {
  try (final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(RabbitConfiguration.class)) {
    final AmqpTemplate template = context.getBean(AmqpTemplate.class);
    template.convertAndSend(QUEUE_NAME, "message");
    template.convertAndSend(QUEUE_NAME2, "message-2");

    await().atMost(15, TimeUnit.SECONDS).until(TestUtil.reportedSpansSize(tracer), equalTo(2));

    assertEquals(2, counter.get());
    final List<MockSpan> spans = tracer.finishedSpans();
    assertEquals(2, spans.size());
  }
}
 
Example #5
Source File: ProfileServiceV1.java    From cloud-native-microservice-strangler-example with GNU General Public License v3.0 5 votes vote down vote up
@Autowired
public ProfileServiceV1(ProfileRepository profileRepository, CustomerClient customerClient,
                        OAuth2RestTemplate oAuth2RestTemplate, AmqpTemplate amqpTemplate) {
    this.profileRepository = profileRepository;
    this.customerClient = customerClient;
    this.oAuth2RestTemplate = oAuth2RestTemplate;
    this.amqpTemplate = amqpTemplate;
}
 
Example #6
Source File: LogMqClient.java    From cloud-service with MIT License 4 votes vote down vote up
public LogMqClient(AmqpTemplate amqpTemplate) {
    this.amqpTemplate = amqpTemplate;
}
 
Example #7
Source File: RequestMappingScan.java    From open-cloud with MIT License 4 votes vote down vote up
public RequestMappingScan(AmqpTemplate amqpTemplate, OpenScanProperties scanProperties) {
    this.amqpTemplate = amqpTemplate;
    this.scanProperties = scanProperties;
}
 
Example #8
Source File: RepublishMessageRecovererExtend.java    From summerframework with Apache License 2.0 4 votes vote down vote up
public RepublishMessageRecovererExtend(AmqpTemplate errorTemplate, AmqpAdmin amqpAdmin) {
    this.errorTemplate = errorTemplate;
    this.deadLetterQueueCreator = new DeadLetterQueueCreator(amqpAdmin);
}
 
Example #9
Source File: RabbitMQClient.java    From kkbinlog with Apache License 2.0 4 votes vote down vote up
public AmqpTemplate getAmqpTemplate() {
    return amqpTemplate;
}
 
Example #10
Source File: RabbitMQConfig.java    From kkbinlog with Apache License 2.0 4 votes vote down vote up
@Bean
public AmqpTemplate amqpTemplate(ConnectionFactory connectionFactory) {
    return new RabbitTemplate(connectionFactory);
}
 
Example #11
Source File: RabbitmqTemplate.java    From shine-mq with Apache License 2.0 4 votes vote down vote up
public RabbitmqTemplate(RabbitmqFactory rabbitmqFactory, AmqpTemplate amqpTemplate,
                        MessageConverter messageConverter) {
    this.rabbitmqFactory = rabbitmqFactory;
    this.eventAmqpTemplate = amqpTemplate;
    this.messageConverter = messageConverter;
}
 
Example #12
Source File: AmqpMessageBroker.java    From piper with Apache License 2.0 4 votes vote down vote up
public void setAmqpTemplate(AmqpTemplate aAmqpTemplate) {
  amqpTemplate = aAmqpTemplate;
}
 
Example #13
Source File: Sender.java    From SpringBootUnity with MIT License 4 votes vote down vote up
@Autowired
public Sender(AmqpTemplate rabbitTemplate) {
    this.rabbitTemplate = rabbitTemplate;
}
 
Example #14
Source File: RabbitmqSendServiceImpl.java    From myth with Apache License 2.0 2 votes vote down vote up
/**
 * Sets amqp template.
 *
 * @param amqpTemplate the amqp template
 */
public void setAmqpTemplate(final AmqpTemplate amqpTemplate) {
    this.amqpTemplate = amqpTemplate;
}
 
Example #15
Source File: ExceptionMessageExchanger.java    From sinavi-jfw with Apache License 2.0 2 votes vote down vote up
/**
 * AMQPテンプレートを設定します。
 * @param amqpTemplate AMQPテンプレート
 */
public void setAmqpTemplate(AmqpTemplate amqpTemplate) {
    this.amqpTemplate = amqpTemplate;
}