boundRequests.set(request); conversationContext.associate(request); conversationContext.activate();
void startConversationScope(String cid) { RequestContextHolder rcHolder = requestContexts.get(); if (rcHolder == null) { startRequestScope(); rcHolder = requestContexts.get(); } conversationContext.associate(new MutableBoundRequest(rcHolder.requestMap, sessionMaps.get())); conversationContext.activate(cid); }
void startConversationScope(String cid) { RequestContextHolder rcHolder = requestContexts.get(); if (rcHolder == null) { startRequestScope(); rcHolder = requestContexts.get(); } conversationContext.associate(new MutableBoundRequest(rcHolder.requestMap, sessionMaps.get())); conversationContext.activate(cid); }
@Override public void activateContext(ConversationState conversationState) { CURRENT_CONVERSATION_STATE.set(conversationState); if (!boundConversationContext.isActive()) { associateContext(); if (conversationState.isLongRunning()) { boundConversationContext.activate(conversationState.getConversationId()); } else { boundConversationContext.activate(); } } }
void startConversationScope(String cid) { conversationContext.associate(new MutableBoundRequest(requestMap,sessionMap)); conversationContext.activate(cid); }
boundRequests.set(request); conversationContext.associate(request); conversationContext.activate();
@Inject private BoundConversationContext boundConversationContext; public void onMessage(Message message) { BoundRequest boundRequest = null; try { boundRequest = new MutableBoundRequest(new HashMap<String, Object>(), new HashMap<String, Object>()); boundConversationContext.associate(boundRequest); if (!boundConversationContext.isActive()) boundConversationContext.activate(); // DO YOUR BUSINESS LOGIC HERE } finally { if (boundConversationContext != null) { if (boundRequest != null) boundConversationContext.dissociate(boundRequest); if (boundConversationContext.isActive()) { boundConversationContext.deactivate(); } } } }
public void callback(Context context, Event event) throws Exception { WeldManager manager = context.get(WeldManager.class); if(manager == null) { throw new IllegalStateException("No " + WeldManager.class.getName() + " found in context"); } CDIConversationID id = context.get(CDIConversationID.class); if(id == null) { id = new CDIConversationID(null); // when null creates a new empty conversation id. } BoundRequest boundRequest = new MutableBoundRequest(context.get(CDIRequestMap.class), context.get(CDISessionMap.class)); context.add(BoundRequest.class, boundRequest); BoundConversationContext conversationContext = manager.instance().select(BoundConversationContext.class).get(); conversationContext.associate(boundRequest); conversationContext.activate(id.getId()); } }
public void createConversation(@Observes(precedence = -1) Before event, WeldManager manager) { if(!enableConversationScope) { return; } CDIConversationID id = conversationId.get(); if(id == null) { id = new CDIConversationID(null); // when null creates a new empty conversation id. } BoundRequest request = new MutableBoundRequest(requestMap.get(), sessionMap.get()); this.boundRequest.set(request); BoundConversationContext conversationContext = manager.instance().select(BoundConversationContext.class).get(); conversationContext.associate(request); conversationContext.activate(id.getId()); }