WeldManager manager = context.get(WeldManager.class);
if(manager == null)
{
throw new IllegalStateException("No " + WeldManager.class.getName() + " found in context");
}
ContextLifecycle lifeCycle = manager.getServices().get(ContextLifecycle.class);
String requestId = UUID.randomUUID().toString();
BeanStore beanStore = new ConcurrentHashMapBeanStore();
lifeCycle.getDependentContext().setActive(true);
lifeCycle.getRequestContext().setActive(true);
lifeCycle.getRequestContext().setBeanStore(beanStore);
context.add(CDIRequestID.class, new CDIRequestID(requestId, beanStore));
}