Polish
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.kafka;
|
||||
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
@@ -26,4 +27,4 @@ class Consumer {
|
||||
System.out.println("Received sample message [" + message + "]");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.kafka;
|
||||
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
@@ -32,4 +33,4 @@ public class Producer {
|
||||
System.out.println("Sent sample message [" + message + "]");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.kafka;
|
||||
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@SpringBootApplication
|
||||
|
||||
@@ -41,11 +41,7 @@ public class SampleMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("SampleMessage{");
|
||||
sb.append("id=").append(this.id);
|
||||
sb.append(", message='").append(this.message).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
return "SampleMessage{id=" + this.id + ", message='" + this.message + "'}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
@@ -64,11 +63,13 @@ public class SampleKafkaApplicationTests {
|
||||
@Bean
|
||||
public Consumer consumer() {
|
||||
return new Consumer() {
|
||||
|
||||
@Override
|
||||
public void processMessage(SampleMessage message) {
|
||||
super.processMessage(message);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user