Skip to content

Instantly share code, notes, and snippets.

View rhoegg's full-sized avatar

Ryan Hoegg rhoegg

View GitHub Profile
@rhoegg
rhoegg / gist:2029e51e298404e486e7
Last active August 29, 2015 14:02
groovy methods for XPath assertions
static final Map<String, String> NAMESPACES = [
env: 'http://schemas.xmlsoap.org/soap/envelope/',
xsd: 'http://www.w3.org/2001/XMLSchema',
xsi: 'http://www.w3.org/2001/XMLSchema-instance'
]
@Before
void initXml() {
evaluator = XPathFactory.newInstance().newXPath()
evaluator.setNamespaceContext([
@rhoegg
rhoegg / mule.conf
Last active August 29, 2015 13:55
upstart script for mule 3.4 and earlier
description "Run Mule ESB"
author "Ryan Hoegg"
setuid mule
setgid nogroup
# we need real ethernet before starting:
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
@rhoegg
rhoegg / idea.txt
Created November 4, 2013 16:15
some concrete requirements for the sample problem
CREATE TABLE door_access (
badge_id INT NOT NULL,
door_id INT NOT NULL,
when TIMESTAMP
)
- monitor table for inserts, there will be no updates
- Send Door ID 53 to AMQP exchange 'SuperSecureBank.alerts.VaultAccess'
- Send Doors 17, 11, 2, 3, 5 to CSV file on box.com folder TBD
- log a warning if any other door badge in occurs
package com.confluex.test.salesforce.sforce
import groovy.util.logging.Slf4j
import org.w3c.dom.Document
import org.w3c.dom.Element
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.stream.XMLOutputFactory
import javax.xml.transform.dom.DOMResult
# Mule and some dependencies
log4j.logger.org.mule=WARN
log4j.logger.com.mulesoft=WARN
log4j.logger.org.mule.DefaultMuleContext=INFO
log4j.logger.org.springframework=WARN
log4j.logger.org.apache=WARN
# Calm down, DataMapper
log4j.logger.org.jetel=WARN
log4j.logger.Tracking=WARN
@rhoegg
rhoegg / gist:7030088
Created October 17, 2013 18:45
mindful usage of mule logger message processor
<logger doc:name="INFO"
category="com.confluex.mule.MyApplicatioName.MyFlowName"
level="INFO"
message="Added #[payload.size()] customer records to ERP system from CRM" />
@rhoegg
rhoegg / mule.sh
Created October 17, 2013 13:31
setting MULE_ENV when starting mule
$MULE_HOME/bin/mule start -M-DMULE_ENV=staging
@rhoegg
rhoegg / wrapper.conf
Created October 17, 2013 13:26
setting MULE_ENV system property in wrapper.conf
wrapper.java.additional.4=-DMULE_ENV=staging
@rhoegg
rhoegg / gist:7024591
Created October 17, 2013 13:09
externalized configuration
<context:property-placeholder
location="classpath:myapp-config.properties,classpath:myapp-config-${MULE_ENV}.properties,file:/opt/mule/conf/${MULE_ENV}/myapp-config.properties"
ignore-resource-not-found="true"
ignore-unresolvable="true" />
@rhoegg
rhoegg / StringFromResource.java
Last active December 22, 2015 22:38
Pull a string out of a file on the classpath in spring
package com.foo;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.core.io.Resource;
public class StringFromResource implements FactoryBean<String> {
private Resource resource;
public Resource getResource() {