public class SubscriberIDGenerator implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
AuthIdentity authIdentity = exchange.getProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString(), AuthIdentity.class);
String subscriberId = null;
//TODO: Check if It's what we need as subscriberID
if (authIdentity == null || authIdentity.getAuth() == null || authIdentity.getApi() == null)
subscriberId = UUID.randomUUID().toString();
else
// Align subscriberId format with SubscriberIdExtractor processor!
subscriberId = new StringBuilder(authIdentity.getApi().getId()).append("|").append(authIdentity.getAuth().getId()).toString();
exchange.getIn().setHeader(E3Constant.SUBSCRIBER_ID_HEADER_NAME, subscriberId);
}