INT-1380, added async-gateway sample, polishing others

This commit is contained in:
Oleg Zhurakousky
2010-09-16 14:07:37 -04:00
parent 973629e36d
commit bfd8637e25
27 changed files with 468 additions and 19 deletions

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:META-INF/spring/integration/stub-services-config.xml" />
<import resource="classpath:META-INF/spring/integration/loan-broker-config.xml" />
<import resource="classpath:META-INF/spring/integration/bank-channel-mappings-config.xml" />
<import resource="classpath:META-INF/spring/integration/shark-detector-config.xml"/>
</beans>

View File

@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:stub-services-config.xml" />
<import resource="classpath:loan-broker-config.xml" />
<import resource="classpath:bank-channel-mappings-config.xml" />
<import resource="classpath:META-INF/spring/integration/stub-services-config.xml" />
<import resource="classpath:META-INF/spring/integration/loan-broker-config.xml" />
<import resource="classpath:META-INF/spring/integration/bank-channel-mappings-config.xml" />
</beans>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:stub-services-config.xml" />
<import resource="classpath:loan-broker-config.xml" />
<import resource="classpath:bank-channel-mappings-config.xml" />
<import resource="classpath:shark-detector-config.xml"/>
</beans>

View File

@@ -41,7 +41,7 @@ public class LoanBrokerDemo {
@Test
public void runDemo() {
ApplicationContext context = new ClassPathXmlApplicationContext("bootstrap-config/stubbed-loan-broker.xml");
ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/integration/bootstrap-config/stubbed-loan-broker.xml");
LoanBrokerGateway broker = context.getBean("loanBrokerGateway", LoanBrokerGateway.class);
LoanRequest loanRequest = new LoanRequest();
loanRequest.setCustomer(new Customer());

View File

@@ -38,7 +38,7 @@ public class LoanBrokerSharkDetectorDemo {
@Test
public void testUdpMulticast() {
ConfigurableApplicationContext context =
new ClassPathXmlApplicationContext("bootstrap-config/stubbed-loan-broker-multicast.xml");
new ClassPathXmlApplicationContext("META-INF/spring/integration/bootstrap-config/stubbed-loan-broker-multicast.xml");
LoanBrokerGateway broker = context.getBean("loanBrokerGateway", LoanBrokerGateway.class);
LoanRequest loanRequest = new LoanRequest();
loanRequest.setCustomer(new Customer());

View File

@@ -0,0 +1,12 @@
//Groovy Script to catch multicast packets.
socket = new MulticastSocket(11111)
mcast = InetAddress.getByName("225.6.7.8")
socket.joinGroup(mcast)
buffer = (' ' * 1024) as byte[]
while(true) {
incoming = new DatagramPacket(buffer, buffer.length)
socket.receive(incoming)
s = new String(incoming.data, 0, incoming.length)
println ("** Shark **" + s)
}

View File

@@ -0,0 +1,16 @@
#!/usr/bin/perl -w
#Perl Script to catch multicast packets.
use strict;
use IO::Socket::Multicast;
my $socket = IO::Socket::Multicast->new(LocalPort=>11111, ReuseAddr=>1)
or die "Can't start UDP server: $@";
$socket->mcast_add('225.6.7.8');
my ($datagram,$flags);
while ($socket->recv($datagram,1024,$flags)) {
print "**Shark** $datagram\n";
}
$socket->close();