org.springframework.cloud.stream.messaging.Source类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.springframework.cloud.stream.messaging.Source类的一些代码示例,展示了Source类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Source类的具体详情如下:
包路径:org.springframework.cloud.stream.messaging.Source
类名称:Source

Source介绍

[英]Bindable interface with one output channel.
[中]带有一个输出通道的可绑定接口。

代码示例

代码示例来源:origin: joshlong/cloud-native-workshop

ReservationApiAdapterRestController(ReservationReader reader,
                  Source source) {
  this.reader = reader;
  this.out = source.output();
}

代码示例来源:origin: apssouza22/java-microservice

/**
 *
 * @param source
 * @param publisher
 */
@Autowired
public EventPublisher(Source source, ApplicationEventPublisher publisher) {
  this.channel = source.output();
  this.publisher = publisher;
}

代码示例来源:origin: org.springframework.cloud.stream.app/spring-cloud-starter-stream-source-load-generator

@Override
  public void run() {
    logger.info(String.format("Producer %d sending %d messages", this.producerId, this.messageCount));
    Message<byte[]> message = new GenericMessage<>(new byte[this.messageSize]);
    for (int i = 0; i < this.messageCount; i++) {
      channel.output().send(message);
    }
    logger.info("All Messages Dispatched");
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-stream-app-starters

@Override
  public void run() {
    logger.info(String.format("Producer %d sending %d messages", this.producerId, this.messageCount));
    Message<byte[]> message = new GenericMessage<>(new byte[this.messageSize]);
    for (int i = 0; i < this.messageCount; i++) {
      channel.output().send(message);
    }
    logger.info("All Messages Dispatched");
  }
}

代码示例来源:origin: Microsoft/spring-cloud-azure

@PostMapping("/messages")
  public String postMessage(@RequestParam String message) {
    this.source.output().send(new GenericMessage<>(message));
    return message;
  }
}

代码示例来源:origin: Microsoft/spring-cloud-azure

@PostMapping("/messages")
  public String sendMessage(@RequestParam String message) {
    this.source.output().send(new GenericMessage<>(message));
    return message;
  }
}

代码示例来源:origin: Microsoft/spring-cloud-azure

@PostMapping("/messages")
  public String postMessage(@RequestParam String message) {
    this.source.output().send(new GenericMessage<>(message));
    return message;
  }
}

代码示例来源:origin: Microsoft/spring-cloud-azure

@PostMapping("/messages")
  public String postMessage(@RequestParam String message) {
    this.source.output().send(new GenericMessage<>(message));
    return message;
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-gcp

@PostMapping("/newMessage")
  public UserMessage sendMessage(@RequestParam("messageBody") String messageBody,
      @RequestParam("username") String username) {
    UserMessage userMessage = new UserMessage(messageBody, username, LocalDateTime.now());
    this.source.output().send(new GenericMessage<>(userMessage));
    return userMessage;
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-stream-app-starters

private void sendMessage(Object body, Object contentType) {
    channels.output().send(MessageBuilder.createMessage(body,
        new MessageHeaders(Collections.singletonMap(MessageHeaders.CONTENT_TYPE, contentType))));
  }
}

代码示例来源:origin: org.springframework.cloud.stream.app/spring-cloud-starter-stream-source-jms

@Bean
public ChannelPublishingJmsMessageListener listener() {
  ChannelPublishingJmsMessageListener listener = new ChannelPublishingJmsMessageListener();
  listener.setRequestChannel(channels.output());
  return listener;
}

代码示例来源:origin: org.springframework.cloud.stream.app/spring-cloud-starter-stream-source-twitterstream

@Bean
public MessageProducer twitterStream(TwitterTemplate twitterTemplate) {
  TwitterStreamMessageProducer messageProducer =
      new TwitterStreamMessageProducer(twitterTemplate, twitterStreamProperties);
  messageProducer.setOutputChannel(source.output());
  return messageProducer;
}

代码示例来源:origin: spring-cloud/spring-cloud-stream-app-starters

@Bean
public ChannelPublishingJmsMessageListener listener() {
  ChannelPublishingJmsMessageListener listener = new ChannelPublishingJmsMessageListener();
  listener.setRequestChannel(channels.output());
  return listener;
}

代码示例来源:origin: spring-cloud/spring-cloud-stream-app-starters

@Bean
public MessageProducer twitterStream(TwitterTemplate twitterTemplate) {
  TwitterStreamMessageProducer messageProducer =
      new TwitterStreamMessageProducer(twitterTemplate, twitterStreamProperties);
  messageProducer.setOutputChannel(source.output());
  return messageProducer;
}

代码示例来源:origin: spring-cloud/spring-cloud-stream-samples

@RequestMapping(value = "/messages", method = RequestMethod.POST)
public String sendMessage() {
  source.output().send(MessageBuilder.withPayload(randomSensor()).build());
  return "ok, have fun with v1 payload!";
}

代码示例来源:origin: spring-cloud/spring-cloud-stream-samples

@RequestMapping(value = "/messages", method = RequestMethod.POST)
public String sendMessage() {
  source.output().send(MessageBuilder.withPayload(randomSensor()).build());
  return "ok, have fun with v1 payload!";
}

代码示例来源:origin: PacktPublishing/Mastering-Spring-Cloud

public boolean send(Order order) {
   return this.source.output().send(MessageBuilder.withPayload(order).build());
}

代码示例来源:origin: spring-cloud/spring-cloud-stream

private MessageChannel getOutputChannel() {
    return this.processor != null ? this.processor.output()
        : (this.source != null ? this.source.output() : new NullChannel());
  }
}

代码示例来源:origin: PacktPublishing/Mastering-Spring-Cloud

public boolean send(Order order) {
   return this.source.output().send(MessageBuilder.withPayload(order).build());
}

代码示例来源:origin: spring-cloud/spring-cloud-stream-samples

@RequestMapping(value = "/messages", method = RequestMethod.POST)
public String sendMessage() {
  source.output().send(MessageBuilder.withPayload(randomSensor()).build());
  return "ok, have fun with v1 payload!";
}

相关文章