String[] uriSplit = splitUri(uri);
if (uriSplit.length > 0) {
switch (ConsumerType.fromUri(uriSplit[0])) {
case DIRECTMESSAGE:
return new DirectMessageConsumer(te);
case SEARCH:
boolean hasNoKeywords = te.getProperties().getKeywords() == null
|| te.getProperties().getKeywords().trim().isEmpty();
if (hasNoKeywords) {
throw new IllegalArgumentException("Type set to SEARCH but no keywords were provided.");