Complete the following for your Hands-on Exercise:
String topic = null;
if (message.getValue().contains("China")) {
topic = "persistent://student31/developer/orderBackLogChina";
} else {
topic = "persistent://student31/developer/orderBackLogUS";
}
Note: DynamicProducerFactory.java will write to the console each time a new producer is created. You should see that exactly two producers are created. Example output:
Starting sn_training.dev_training.OrderProducer
Will publish order 1US asynchronously to topic persistent://student31/developer/orderBackLogUS
Creating new producer with topic persistent://student31/developer/orderBackLogUS
Will publish order 2China asynchronously to topic persistent://student31/developer/orderBackLogChina
Creating new producer with topic persistent://student31/developer/orderBackLogChina
Will publish order 3US asynchronously to topic persistent://student31/developer/orderBackLogUS
Will publish order 4China asynchronously to topic persistent://student31/developer/orderBackLogChina
Will publish order 5US asynchronously to topic persistent://student31/developer/orderBackLogUS
Will publish order 6China asynchronously to topic persistent://student31/developer/orderBackLogChina