@Override public DependencyProvider provider() { return DependencyProvider.from(); } }
@Override public void channelRead0(ChannelHandlerContext ctx, EventMessage msg) throws Exception { int matches = 0; for (InvokableMethod method : methods) { if (method.matches(msg.name(), ctx, msg)) { Object response = method.invoke(ctx, msg.name(), msg, msg.params(), DependencyProvider.from()); if (response instanceof TypeMismatch) { continue; } matches++; } } if (matches == 0) { log.debug(String.format("Event received but no subscribers found (%s)", msg)); } } }
@Override public void channelRead0(ChannelHandlerContext ctx, EventMessage msg) throws Exception { int matches = 0; for (InvokableMethod method : methods) { if (method.matches(msg.name(), ctx, msg)) { Object response = method.invoke(ctx, msg.name(), msg, msg.params(), DependencyProvider.from()); if (response instanceof TypeMismatch) { continue; } matches++; } } if (matches == 0) { log.debug(String.format("Event received but no subscribers found (%s)", msg)); } } }
/** * Invoke this method using the parameters provided * * @param ctx channel context * @param path method path extracted from incoming request * @param msg the original message * @param params parameters extracted from message * @param provider */ public Object invoke(ChannelHandlerContext ctx, String path, Object msg, Object[] params, DependencyProvider provider) throws InvocationTargetException, IllegalAccessException, InstantiationException { Object instance = createInstance(); DependencyProvider deps = provider == null ? DependencyProvider.from() : provider; deps.add(ctx, ctx.channel(), ctx.executor(), msg); Injector.inject(instance, deps); Object[] depParams = injectParameters(ctx, msg, params, instance, deps); if (instance instanceof EventListenerMethod) { ((EventListenerMethod) instance).init(); } return classMethod.invoke(instance, depParams); }
/** * Invoke this method using the parameters provided * * @param ctx channel context * @param path method path extracted from incoming request * @param msg the original message * @param params parameters extracted from message * @param provider */ public Object invoke(ChannelHandlerContext ctx, String path, Object msg, Object[] params, DependencyProvider provider) throws InvocationTargetException, IllegalAccessException, InstantiationException { Object instance = createInstance(); DependencyProvider deps = provider == null ? DependencyProvider.from() : provider; deps.add(ctx, ctx.channel(), ctx.executor(), msg); Injector.inject(instance, deps); Object[] depParams = injectParameters(ctx, msg, params, instance, deps); if (instance instanceof EventListenerMethod) { ((EventListenerMethod) instance).init(); } return classMethod.invoke(instance, depParams); }
injectParams(params, method, request, frame, handler, ctx, config, method, pusher); try { Object returns = method.invoke(ctx, request.getPath(), request, params, DependencyProvider.from()); pusher.push(returns); } catch (InvocationTargetException | IllegalAccessException | InstantiationException e) {
injectParams(params, method, request, frame, handler, ctx, config, method, pusher); try { Object returns = method.invoke(ctx, request.getPath(), request, params, DependencyProvider.from()); pusher.push(returns); } catch (InvocationTargetException | IllegalAccessException | InstantiationException e) {
DependencyProvider provider = decoder == null ? DependencyProvider.from() : decoder.provider();