Examples of batchingStrategy()


Examples of com.netflix.eventbus.spi.Subscribe.batchingStrategy()

                    if (!parameterTypes[0].isAssignableFrom(targetedEventType)) {
                        errors.put(method, String.format(
                                "Dynamic subscriber: %s's Method: %s's argument is not compatible with the interested event type %s.",
                                subscriber.getClass(), method.toGenericString(), targetedEventType.getName()));
                    }
                } else if (subscribeAnnotation.batchingStrategy() != Subscribe.BatchingStrategy.None) {
                    if (!(Iterable.class.isAssignableFrom(parameterTypes[0]))) {
                        errors.put(method, String.format(
                                "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does not accept an Iterable argument.",
                                subscriber.getClass(), method.toGenericString(),
                                subscribeAnnotation.batchingStrategy()));
View Full Code Here

Examples of com.netflix.eventbus.spi.Subscribe.batchingStrategy()

                } else if (subscribeAnnotation.batchingStrategy() != Subscribe.BatchingStrategy.None) {
                    if (!(Iterable.class.isAssignableFrom(parameterTypes[0]))) {
                        errors.put(method, String.format(
                                "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does not accept an Iterable argument.",
                                subscriber.getClass(), method.toGenericString(),
                                subscribeAnnotation.batchingStrategy()));
                    } else {
                        Type[] genericParameterTypes = method.getGenericParameterTypes();
                        if (!(genericParameterTypes[0] instanceof ParameterizedType)) {
                            errors.put(method, String.format(
                                    "Subscriber: %s's Method: %s is a subscriber for java.lang.Object, that is too broad an interest.",
View Full Code Here

Examples of com.netflix.eventbus.spi.Subscribe.batchingStrategy()

                                    "Subscriber: %s's Method: %s is a subscriber for java.lang.Object, that is too broad an interest.",
                                    subscriber.getClass(), method.toGenericString()));
                        }
                    }

                    switch (subscribeAnnotation.batchingStrategy()) {
                        case SizeOrAge:
                            if (subscribeAnnotation.batchSize() <= 1) {
                                errors.put(method, String.format(
                                        "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does define a batch size.",
                                        subscriber.getClass(), method.toGenericString(),
View Full Code Here

Examples of com.netflix.eventbus.spi.Subscribe.batchingStrategy()

                        case SizeOrAge:
                            if (subscribeAnnotation.batchSize() <= 1) {
                                errors.put(method, String.format(
                                        "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does define a batch size.",
                                        subscriber.getClass(), method.toGenericString(),
                                        subscribeAnnotation.batchingStrategy()));
                            }
                        case Age:
                            if (subscribeAnnotation.batchAge() <= 0) {
                                errors.put(method, String.format(
                                        "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does define a batch age.",
View Full Code Here

Examples of com.netflix.eventbus.spi.Subscribe.batchingStrategy()

                        case Age:
                            if (subscribeAnnotation.batchAge() <= 0) {
                                errors.put(method, String.format(
                                        "Subscriber: %s's Method: %s is annotated with batching strategy: %s but does define a batch age.",
                                        subscriber.getClass(), method.toGenericString(),
                                        subscribeAnnotation.batchingStrategy()));
                            }
                            break;
                    }
                }
            }
View Full Code Here

Examples of com.netflix.eventbus.spi.Subscribe.batchingStrategy()

    public static Class<?> getInterestedEventType(Object subscriber, Method subMethod) {
        Class<?> interestedEventType = (DynamicSubscriber.class.isAssignableFrom(subscriber.getClass()))
                          ? ((DynamicSubscriber) subscriber).getEventType()
                          : subMethod.getParameterTypes()[0];/* The subscriber method must be valid here. */
        Subscribe annotation = subMethod.getAnnotation(Subscribe.class);
        if (annotation.batchingStrategy() != Subscribe.BatchingStrategy.None
            && Iterable.class.isAssignableFrom(interestedEventType)) {
            // Batch consumer, the parameter type of Iterable is the actual event type.
            Type[] genericMethodParams = subMethod.getGenericParameterTypes();
            ParameterizedType interestedEventParam = (ParameterizedType) genericMethodParams[0]; // Validation ensures that the argument is generic Iterable.
            Type[] iterableTypeParams = interestedEventParam.getActualTypeArguments();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.