/** * Accepts only release announce. */ public boolean isRelease(@Body SyndFeed feed) { SyndEntry firstEntry = (SyndEntry) feed.getEntries().get(0); return firstEntry.getTitle().toLowerCase().contains("release"); }
public void addItem(@Header("sessionId") String sessionId, @Body CartDto dto) { LOG.info("addItem {} {}", sessionId, dto); Set<CartDto> dtos = content.get(sessionId); if (dtos == null) { dtos = new LinkedHashSet<>(); content.put(sessionId, dtos); } dtos.add(dto); }
public void addItem(@Header("sessionId") String sessionId, @Body CartDto dto) { LOG.info("addItem {} {}", sessionId, dto); Set<CartDto> dtos = content.get(sessionId); if (dtos == null) { dtos = new LinkedHashSet<>(); content.put(sessionId, dtos); } dtos.add(dto); }
public Document handleIncomingOrder(@Body Document xml, @XPath("/order/@customerId") int customerId, @Bean(ref = "guid", method = "generate") int orderId) { Attr attr = xml.createAttribute("orderId"); attr.setValue("" + orderId); Node node = xml.getElementsByTagName("order").item(0); node.getAttributes().setNamedItem(attr); return xml; }
@SuppressWarnings("PMD.UseLocaleWithCaseConversions") public String myProcessor(@Body String body) { return body.toUpperCase(); } }
@Handler public Map getProcessVariables(@Body String body, @Header(Exchange.FILE_NAME) String filename, @Simple("${date:now:yyyy-MM-dd kk:mm:ss}") String timestamp) { Map<String, Object> variables = new HashMap<String, Object>(); variables.put("message", body); variables.put("orderid", filename); variables.put("timestamp", timestamp); return variables; } }
@SuppressWarnings("PMD.UseLocaleWithCaseConversions") public String process(@Body String body) { return body.toUpperCase(); } }
public String createCamelEmail(Exchange in, @Body ExpiringSubscriptionEmail expiringSubscriptionEmail) { in.getIn().setHeader("to", expiringSubscriptionEmail.getTo()); in.getIn().setHeader("subject", expiringSubscriptionEmail.getSubject()); return expiringSubscriptionEmail.getMessageBody(); }
public String process(@Body String body) { return body.toUpperCase(); } }
public Document handleIncomingOrder(@Body Document xml, @XPath(value = "/c:order/@customerId", namespaces = @NamespacePrefix( prefix = "c", uri = "http://camelinaction.com/order")) int customerId, @Bean(ref = "guid", method = "generate") int orderId) { Attr attr = xml.createAttribute("orderId"); attr.setValue("" + orderId); Node node = xml.getElementsByTagName("order").item(0); node.getAttributes().setNamedItem(attr); return xml; }
@Handler public void setMsgPriority(@Body Message msg) { // new messages will be processed earlier then PARTLY_FAILED or POSTPONED messages msg.setProcessingPriority(NEW_MSG_PRIORITY); }
/** * Splits specified message into smaller messages. * * @param parentMsg the parent message * @param body the body */ @Handler void splitMessage(@Header(AsynchConstants.MSG_HEADER) Message parentMsg, @Body Object body); }
public void needCreated(@Header("wonNodeURI") final String wonNodeURI, @Header("needURI") final String needURI, @Body final String content) { logger.debug("new need received: {} with content {}", needURI, content); delegate.onNewNeed(URI.create(wonNodeURI), URI.create(needURI), RdfUtils.toDataset(content)); } public void needActivated(@Header("wonNodeURI") final String wonNodeURI,
@Handler public String apply(@Body String body) { return "Hello " + body; } }
@Handler public void handle(@Body String body) { // NO-OP } }
@Handler public String[] apply(@Body String body) { return new String[]{ "Hiram", "World" }; } }
@Handler public SyncHelloResponse composeGreeting(@Body SyncHelloRequest req) { Assert.notNull(req, "req must not be null"); String greeting = "Hello " + req.getName(); SyncHelloResponse res = new SyncHelloResponse(); res.setGreeting(greeting); return res; } }
@Handler public int apply(@Body String body) { return body.hashCode(); } }
@Handler public String configure(@Body String body, @Header("ExtensionHeader") String header) { return String.join("-", body, header, message); } }
public boolean filter(@Body Object input, @Headers Map<String, Object> headers) { final Object body = process(input, headers); try { CustomFilter filter = (CustomFilter) customFilterClass.newInstance(); plugin.getContext().getInjector().inject(filter, plugin.getContext()); return body != null && filter.filter(body); } catch (Exception e) { logger.warn("Failed to instantiate the filter class for plugin " + plugin.getId(), e); } return false; }