Here are the examples of the java api lib.GiphyService taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
15
View Complete Implementation : App.java
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
@EnableKafka
@SpringBootApplication
@ComponentScan(basePackages = "lib")
public clreplaced App {
@Bean
public AppId appId() {
return new AppId("giphy-service");
}
@Autowired
GiphyService giphy;
@Autowired
KafkaService kafka;
@Autowired
Tracer tracer;
@KafkaListener(topics = "message")
public void process(@Payload Message message, @Headers MessageHeaders headers) throws Exception {
Span span = kafka.startConsumerSpan("process", headers);
try (Scope scope = tracer.scopeManager().activate(span, true)) {
System.out.println("Received message: " + message.message);
if (message.image == null && message.message.trim().startsWith("/giphy")) {
String query = message.message.split("/giphy")[1].trim();
System.out.println("Giphy requested: " + query);
message.image = giphy.query(query);
if (message.image != null) {
kafka.sendMessage(message);
System.out.println("Updated message, url=" + message.image);
}
}
}
}
public static void main(String[] args) throws Exception {
SpringApplication.run(App.clreplaced, args);
}
}