@Consume(uri="jms://test.books") public void receiveBook(Book book) { System.out.println("Received book over jms: " + book); }
.map(Annotated::getAnnotations) .flatMap(Set::stream) .anyMatch(isAnnotationType(Consume.class).and(a -> ((Consume) a).context().isEmpty()) .or(isAnnotationType(BeanInject.class).and(a -> ((BeanInject) a).context().isEmpty())) .or(isAnnotationType(EndpointInject.class).and(a -> ((EndpointInject) a).context().isEmpty()))
@Consume(uri = "jms:partnerInventoryUpdate") public void updateInventory(Inventory inventory) { jdbc.execute(toSql(inventory)); }
@Consume(uri = "jms:partnerInventoryUpdate") public void updateInventory(Inventory inventory) { jdbc.execute(toSql(inventory)); partnerAudit.audit(inventory); }
@Consume(uri = "jms:partnerInventoryUpdate") public void updateInventory(Inventory inventory) { jdbc.execute(toSql(inventory)); partnerAudit.sendBody(inventory); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Consume(property="endpointUri") public void dispatch(final Object message) throws NoSuchMethodException, SecurityException { LOG.debug("dispatch: {}", message); if (m_tracker == null) { m_tracker = new ServiceTracker(m_context, m_serviceClass, null); m_tracker.open(); } if (m_method == null) { m_method = m_serviceClass.getMethod(m_methodName, m_messageClass); } try { Object[] services = m_tracker.getServices(); if (services != null && services.length > 0) { for (Object service : m_tracker.getServices()) { m_method.invoke(service, message); } } else { // in case there is no dispatcher registered, let the user know. LOG.warn("No dispatcher for message found. ServiceClass: {}, ServiceMethod: {}", m_serviceClass, m_methodName); } } catch (Throwable e) { // If anything goes wrong, log an error message // TODO: Use a dead-letter channel? LOG.warn("Message dispatch failed: " + e.getMessage(), e); } } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Consume(property="endpointUri") public void dispatch(final Object message) throws NoSuchMethodException, SecurityException { LOG.debug("dispatch: {}", message); if (m_tracker == null) { m_tracker = new ServiceTracker(m_context, m_serviceClass, null); m_tracker.open(); } if (m_method == null) { m_method = m_serviceClass.getMethod(m_methodName, m_messageClass); } try { Object[] services = m_tracker.getServices(); if (services != null && services.length > 0) { for (Object service : m_tracker.getServices()) { m_method.invoke(service, message); } } else { // in case there is no dispatcher registered, let the user know. LOG.warn("No dispatcher for message found. ServiceClass: {}, ServiceMethod: {}", m_serviceClass, m_methodName); } } catch (Throwable e) { // If anything goes wrong, log an error message // TODO: Use a dead-letter channel? LOG.warn("Message dispatch failed: " + e.getMessage(), e); } } }