Bumped to work with jdk11
This commit is contained in:
@@ -18,16 +18,23 @@ package com.example;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BookDeleted implements Serializable {
|
||||
|
||||
public final String bookName;
|
||||
public String bookName;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
|
||||
public BookDeleted(String bookName) {
|
||||
this.bookName = bookName;
|
||||
}
|
||||
|
||||
public BookDeleted() {
|
||||
}
|
||||
|
||||
public String getBookName() {
|
||||
return this.bookName;
|
||||
}
|
||||
|
||||
void setBookName(String bookName) {
|
||||
this.bookName = bookName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||
import org.springframework.cloud.stream.annotation.StreamListener;
|
||||
import org.springframework.cloud.stream.messaging.Sink;
|
||||
import org.springframework.cloud.stream.messaging.Source;
|
||||
import org.springframework.messaging.support.MessageBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@EnableBinding({ DeleteSink.class, Sink.class })
|
||||
@Component
|
||||
public class BookListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BookListener.class);
|
||||
@@ -54,7 +55,7 @@ public class BookListener {
|
||||
* server side: will send a message to input, verify the message contents and await
|
||||
* upon receiving message on the output messageFrom
|
||||
*/
|
||||
@StreamListener(DeleteSink.INPUT)
|
||||
@StreamListener(DeleteSink.MYINPUT)
|
||||
public void bookDeleted(BookDeleted bookDeleted) {
|
||||
log.info("Deleting book " + bookDeleted);
|
||||
// ... doing some work
|
||||
|
||||
@@ -18,16 +18,23 @@ package com.example;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BookReturned implements Serializable {
|
||||
|
||||
public final String bookName;
|
||||
public String bookName;
|
||||
|
||||
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
|
||||
BookReturned(String bookName) {
|
||||
public BookReturned(String bookName) {
|
||||
this.bookName = bookName;
|
||||
}
|
||||
|
||||
public BookReturned() {
|
||||
}
|
||||
|
||||
public String getBookName() {
|
||||
return this.bookName;
|
||||
}
|
||||
|
||||
void setBookName(String bookName) {
|
||||
this.bookName = bookName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,16 @@
|
||||
package com.example;
|
||||
|
||||
import org.springframework.cloud.stream.annotation.Input;
|
||||
import org.springframework.cloud.stream.messaging.Sink;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
interface DeleteSink extends Sink {
|
||||
interface DeleteSink {
|
||||
|
||||
String INPUT = "delete";
|
||||
String MYINPUT = "delete";
|
||||
|
||||
@Input(DeleteSink.INPUT)
|
||||
@Input(DeleteSink.MYINPUT)
|
||||
SubscribableChannel delete();
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.cloud.stream.messaging.Sink;
|
||||
import org.springframework.cloud.stream.messaging.Source;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableBinding({ Source.class, Sink.class })
|
||||
@EnableBinding({ Source.class, DeleteSink.class, Sink.class })
|
||||
class StreamMessagingApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user