[jboss-svn-commits] JBL Code SVN: r7912 - in labs/jbossesb/trunk/product/samples/trailblazer2: . banks banks/lib/ext banks/src banks/src/org banks/src/org/jboss banks/src/org/jboss/soa banks/src/org/jboss/soa/esb banks/src/org/jboss/soa/esb/samples banks/src/org/jboss/soa/esb/samples/loanbroker banks/src/org/jboss/soa/esb/samples/loanbroker/banks client/resources esb/conf
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 28 19:17:50 EST 2006
Author: daniel.brum at jboss.com
Date: 2006-11-28 19:17:40 -0500 (Tue, 28 Nov 2006)
New Revision: 7912
Added:
labs/jbossesb/trunk/product/samples/trailblazer2/banks/bank.properties
labs/jbossesb/trunk/product/samples/trailblazer2/banks/lib/ext/log4j.jar
labs/jbossesb/trunk/product/samples/trailblazer2/banks/monitored_folders/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/Bank.java
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteReply.java
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteRequest.java
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/FileUtil.java
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerFlatFile.java
labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerJMS.java
labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/from__loanbroker.cdrl
labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/smooks-cdr.lst
labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/to____jmsbank.cdrl
labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/banksgateway-esb.xml
Modified:
labs/jbossesb/trunk/product/samples/trailblazer2/banks/build.xml
labs/jbossesb/trunk/product/samples/trailblazer2/build.properties
labs/jbossesb/trunk/product/samples/trailblazer2/build.xml
labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml
Log:
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/bank.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/bank.properties 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/bank.properties 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,4 @@
+jms.provider.url=localhost
+file.monitored.directory=C:\dev\JBossESB\trunk\product\samples\trailblazer2\banks\monitored_folders\input
+jms.queue.in=queue/C
+jms.queue.out=queue/D
Modified: labs/jbossesb/trunk/product/samples/trailblazer2/banks/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/build.xml 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/build.xml 2006-11-29 00:17:40 UTC (rev 7912)
@@ -2,7 +2,7 @@
<property file="bank.properties"/>
<!-- Some default build locations -->
- <property name="org.jboss.esb.ext.lib.dir" value="../lib"/>
+ <property name="org.jboss.esb.ext.lib.dir" value="../../../lib"/>
<property name="org.jboss.esb.samples.loanbroker.banks.dest" value="${basedir}/build"/>
<property name="org.jboss.esb.samples.loanbroker.banks.classes.dir" value="${basedir}/build/classes/banks/"/>
<property name="org.jboss.esb.samples.loanbroker.banks.testclasses.dir" value="${basedir}/build/classes/tests/"/>
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/lib/ext/log4j.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/trailblazer2/banks/lib/ext/log4j.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/Bank.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/Bank.java 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/Bank.java 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,117 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.soa.esb.samples.loanbroker.banks;
+
+import java.math.BigDecimal;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+
+/**
+ * This Bank is pretty well focussed on doing one thing, which is giving out loans. On the
+ * reception of a BankQuoteRequest it will compute the interest rate it will return
+ * in the BankQuoteReply.
+ *
+ * Each bank instance can be customized using the parameters bankName, RatePremium and MaxLoanTerm.
+ *
+ * @author kstam
+ *
+ */
+public class Bank
+{
+ private Logger logger = Logger.getLogger(this.getClass());
+
+ private static final BigDecimal PRIME_RATE = BigDecimal.valueOf(8.0);
+ private static final BigDecimal DEFAULT_RATE_PREMIUM = BigDecimal.valueOf(0.5);
+ private static final int DEFAULT_MAX_LOAN_TERM = 30;
+ private static final String DEFAULT_BANK_NAME = "DefaultBank";
+ private static int _quoteCounter = 0;
+
+ //Default values for bank
+ private String bankName = DEFAULT_BANK_NAME;
+ private BigDecimal ratePremium = DEFAULT_RATE_PREMIUM;
+ private int maxLoanTerm = DEFAULT_MAX_LOAN_TERM;
+
+ /**
+ * The Bank's constructor.
+ *
+ * @param bankName - the name of the bank
+ * @param ratePremium - the premium it charges for the loan
+ * @param maxLoanTerm - the maximum loan term
+ */
+ public Bank(String bankName, BigDecimal ratePremium, int maxLoanTerm) {
+ super();
+ if (bankName!=null) {
+ this.bankName=bankName;
+ }
+ if (ratePremium!=null) {
+ this.ratePremium=ratePremium;
+ }
+ if (maxLoanTerm > 0) {
+ this.maxLoanTerm=maxLoanTerm;
+ }
+ }
+ /**
+ * The bank computes the interest rate based on configuration parameters of the bank and
+ * the information in the {@link BankQuoteRequest.
+ * @param bankQuoteRequest - the bank quote request containing requests parameters
+ * @return bankQuoteReply - the bank quote replay contaning the interest rate
+ */
+ private BankQuoteReply computeBankQuoteReply(BankQuoteRequest bankQuoteRequest)
+ {
+ BankQuoteReply bankQuoteReply = new BankQuoteReply();
+ if (bankQuoteRequest.loanTerm <= maxLoanTerm) {
+ BigDecimal interestRate=BigDecimal.valueOf((bankQuoteRequest.loanTerm/12.0)/10.0);
+ interestRate=PRIME_RATE.add(ratePremium).add(interestRate);
+ bankQuoteReply.setInterestRate(interestRate.setScale(2, BigDecimal.ROUND_HALF_UP));
+ bankQuoteReply.setErrorCode(0);
+ } else {
+ bankQuoteReply.setInterestRate(BigDecimal.valueOf(0.00).setScale(2, BigDecimal.ROUND_HALF_UP));
+ bankQuoteReply.setErrorCode(1);
+ }
+ String quoteId=bankName + "-" + _quoteCounter++;
+ bankQuoteReply.setQuoteId(quoteId);
+ bankQuoteReply.setCustomerUID(bankQuoteRequest.getCustomerUID());
+ return bankQuoteReply;
+ }
+ /**
+ * Processes the Loan Quote request and returns the banks reply.
+ *
+ * @param bankQuoteRequest - the bank quote request
+ * @return bankQuoteReply - the bank quote reply
+ */
+ protected BankQuoteReply processMessage(BankQuoteRequest bankQuoteRequest)
+ {
+ logger.log(Priority.INFO, "Bank '" + bankName + "' received a request for SSN="
+ + bankQuoteRequest.getSsn()
+ + " for $" + bankQuoteRequest.loanAmount
+ + " over " + bankQuoteRequest.loanTerm + " months.");
+ logger.log(Priority.DEBUG, bankQuoteRequest);
+
+ BankQuoteReply bankQuoteReply = computeBankQuoteReply(bankQuoteRequest);
+ logger.log(Priority.INFO, "Bank '" + bankName + " offers SSN="
+ + bankQuoteRequest.getSsn() + " " + bankQuoteReply);
+
+ return bankQuoteReply;
+ }
+}
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteReply.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteReply.java 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteReply.java 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,117 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.samples.loanbroker.banks;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+
+public class BankQuoteReply implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private BigDecimal interestRate;
+ private String quoteId;
+ private int errorCode;
+ private String customerUID;
+
+ /**
+ * Gets the SerialVersionUID.
+ * @return serialVersionUID
+ */
+ public static long getSerialVersionUID() {
+ return serialVersionUID;
+ }
+ /**
+ * Gets the errorCode.
+ * <li>0 - success
+ * <li>1 - loan term exceeds the maximum available loan term
+ * <li>2 - invalid SSN
+ * <li>3 - invalid credit score
+ * <li>4 - invalid credit history length
+ * <li>5 - invalid loan term
+ * <li>6 - invalid message
+ * <li>7 - invalid customerUID
+ * @return errorCode
+ */
+ public int getErrorCode() {
+ return errorCode;
+ }
+ /**
+ * Sets the errorCode.
+ * <li>0 - success
+ * <li>1 - loan term exceeds the maximum available loan term
+ * <li>2 - invalid SSN
+ * <li>3 - invalid credit score
+ * <li>4 - invalid credit history length
+ * <li>5 - invalid loan term
+ * @param errorCode
+ */
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+ /**
+ * Gets the quoted interest rate.
+ * @return interestRate
+ */
+ public BigDecimal getInterestRate() {
+ return interestRate;
+ }
+ /**
+ * Sets the quoted interest rate.
+ * @param interestRate
+ */
+ public void setInterestRate(BigDecimal interestRate) {
+ this.interestRate = interestRate;
+ }
+ /**
+ * Gets the Quote ID.
+ * @return quoteId
+ */
+ public String getQuoteId() {
+ return quoteId;
+ }
+ /**
+ * Sets the quoteId.
+ * @param quoteId
+ */
+ public void setQuoteId(String quoteId) {
+ this.quoteId = quoteId;
+ }
+ /**
+ * Returns a human readable string representation of this object.
+ * @return toString
+ */
+ public String toString() {
+ return this.getClass().getSimpleName() + "=["
+ + "interestRate=" + interestRate
+ + ", quoteId=" + quoteId
+ + ", errorCode=" + errorCode
+ + ", customerUID=" + customerUID + "]";
+ }
+ public String getCustomerUID() {
+ return customerUID;
+ }
+ public void setCustomerUID(String customerUID) {
+ this.customerUID = customerUID;
+ }
+}
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteRequest.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteRequest.java 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/BankQuoteRequest.java 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,127 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.samples.loanbroker.banks;
+
+import java.io.Serializable;
+
+
+public class BankQuoteRequest implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ public int ssn;
+ public int creditScore;
+ public int historyLength;
+ public int loanAmount;
+ public int loanTerm;
+ public String customerUID;
+
+ /**
+ * Gets for the credit score.
+ * @return credit score
+ */
+ public int getCreditScore() {
+ return creditScore;
+ }
+ /**
+ * Sets the credit score.
+ * @param creditScore
+ */
+ public void setCreditScore(int creditScore) {
+ this.creditScore = creditScore;
+ }
+ /**
+ * Gets the credit history length (in months).
+ * @return credit history length
+ */
+ public int getHistoryLength() {
+ return historyLength;
+ }
+ /**
+ * Sets the credit history length (in months).
+ * @param historyLength
+ */
+ public void setHistoryLength(int historyLength) {
+ this.historyLength = historyLength;
+ }
+ /**
+ * Gets the requested loan amount (in dollar).
+ * @return the loan amount
+ */
+ public int getLoanAmount() {
+ return loanAmount;
+ }
+ /**
+ * Sets the loan amount.
+ * @param loanAmount - the loan amount (in dollar).
+ */
+ public void setLoanAmount(int loanAmount) {
+ this.loanAmount = loanAmount;
+ }
+ /**
+ * Gets the duration of the loan, the term, (in months).
+ * @return loanTerm
+ */
+ public int getLoanTerm() {
+ return loanTerm;
+ }
+ /**
+ * Sets the term (duration) of the loan (in months)
+ * @param loanTerm
+ */
+ public void setLoanTerm(int loanTerm) {
+ this.loanTerm = loanTerm;
+ }
+ /**
+ * Sets the Social Security Number (SSN).
+ * @return ssn
+ */
+ public int getSsn() {
+ return ssn;
+ }
+ /**
+ * Sets the Social Security Number (SSN).
+ * @param ssn
+ */
+ public void setSsn(int ssn) {
+ this.ssn = ssn;
+ }
+ /**
+ * Returns a human readable string representation of this object.
+ * @return toString
+ */
+ public String toString() {
+ return this.getClass().getSimpleName() + "=["
+ + "ssn=" + ssn
+ + ", creditScore=" + creditScore
+ + ", historyLength=" + historyLength
+ + ", loanAmount=" + loanAmount
+ + ", loanTerm=" + loanTerm
+ + ", customerUID="+ customerUID + "]";
+ }
+
+ public String getCustomerUID() {
+ return customerUID;
+ }
+ public void setCustomerUID(String customerUID) {
+ this.customerUID = customerUID;
+ }
+}
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/FileUtil.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/FileUtil.java 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/FileUtil.java 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.samples.loanbroker.banks;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+/**
+ * Utility class for reading a file into a String and back.
+ * @author kstam
+ */
+public class FileUtil {
+ /**
+ * Read the file into a String.
+ * @param file - the file to be read
+ * @return String with the content of the file
+ * @throws IOException - when we can't read the file
+ */
+ public static String readTextFile(File file) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new FileReader(file.getPath()));
+ char[] chars = new char[1];
+ while( (reader.read(chars)) > -1){
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+ /**
+ * Write a String into a file.
+ * @param file - File to which we write the String
+ * @param str - string which will be written
+ * @throws IOException - when we can't write to the file
+ */
+ public static void writeTextFile(File file, String str) throws IOException
+ {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(file.getPath()));
+ writer.write(str);
+ writer.close();
+ }
+
+}
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerFlatFile.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerFlatFile.java 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerFlatFile.java 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,211 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.samples.loanbroker.banks;
+
+import java.io.File;
+import java.math.BigDecimal;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.sadun.util.polling.BasePollManager;
+import org.sadun.util.polling.CycleEndEvent;
+import org.sadun.util.polling.CycleStartEvent;
+import org.sadun.util.polling.DirectoryLookupEndEvent;
+import org.sadun.util.polling.DirectoryLookupStartEvent;
+import org.sadun.util.polling.DirectoryPoller;
+import org.sadun.util.polling.FileFoundEvent;
+import org.sadun.util.polling.FileSetFoundEvent;
+
+/**
+ * The FlatFilePollManager monitors a directory specified in the configuration. When a file arrives it
+ * tries to process the content assuming it contains one line with loan request information.
+ * So for example the content of the file could read some like <br>23456890,3,4,20000,5<br>
+ * The order of values needs to be SocialSecurityNumber, CreditScore, HistoryLength [month], LoanAmount [dollar],
+ * and finally the LoanTerm [month]. The request will be processed and a BankQouteReply is generated. The
+ * original file is moved to a 'processed' directory, and the BankQuoteReply is serialized to an 'outgoing'
+ * directory from the it can be picked up by the system that dropped the request.
+ *
+ * @author kstam
+ *
+ */
+class ManagerFlatFile extends BasePollManager
+{
+ private Logger logger = Logger.getLogger(this.getClass());
+
+ private static final String BANK_NAME = "FileBasedBank";
+ private static final BigDecimal RATE_PREMIUM = BigDecimal.valueOf(0.25);
+ private static final int MAXLOANTERM = 120;
+ protected static final String OUTGOING_DIR = "outgoing";
+ protected static final String PREFIX = "reply_to_";
+ protected static final String PROCESSED_DIR = "processed";
+ /**
+ * Handle to the cycle start event.
+ */
+ public void cycleStarted(CycleStartEvent evt) {
+ logger.log(Priority.DEBUG, "Poller awakened "
+ + (evt.getPoller().getFilter() == null ? "(no filtering)" : evt
+ .getPoller().getFilter().toString()));
+ }
+ /**
+ * Handle to the cycle end event.
+ */
+ public void cycleEnded(CycleEndEvent evt) {
+ logger.log(Priority.DEBUG, "Poller going to sleep");
+ }
+ /**
+ * Handle to the directory lookup start event.
+ */
+ public void directoryLookupStarted(DirectoryLookupStartEvent evt) {
+ logger.log(Priority.DEBUG, "Scanning " + evt.getDirectory());
+ }
+ /**
+ * Handle to the directory lookup end event.
+ */
+ public void directoryLookupEnded(DirectoryLookupEndEvent evt) {
+ logger.log(Priority.DEBUG, "Finished scanning " + evt.getDirectory());
+ }
+ /**
+ * Handle to the file set found event. Currenty this is the only event that
+ * is actually used to proces the incoming loan quote requests. Each file
+ * is send to be processed.
+ */
+ public void fileSetFound(FileSetFoundEvent evt) {
+ File[] files = evt.getFiles();
+
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ processFile(file);
+ }
+ }
+ /**
+ * Handle to the file found event.
+ */
+ public void fileFound(FileFoundEvent evt) {
+ logger.log(Priority.DEBUG, evt);
+ // Add artificial delay
+ }
+ /**
+ * Returns the name of this PollManager and a quick summary of what it does.
+ */
+ public String toString() {
+ return "FlatFilePollManager - a pollmanager which processed incoming -flat file based- loan requests";
+ }
+ /**
+ * Each file is processed assuming it contains one line with loan request information.
+ * So for example the content of the file could read some like <br>23456890,3,4,20000,5<br>
+ * The order of values needs to be SocialSecurityNumber, CreditScore, HistoryLength [month], LoanAmount [dollar],
+ * and finally the LoanTerm [month]. The BankQuoteRequest is processed and a BankQouteReply is generated. The
+ * original file is moved to a processed directory, and the BankQuoteReply is serialized to an 'outgoing'
+ * directory from the it can be picked up by the system that dropped the request.
+ *
+ * @param file - incoming flat file with loan quote request info.
+ */
+ protected void processFile(File file)
+ {
+ BankQuoteReply bankQuoteReply=new BankQuoteReply();
+ bankQuoteReply.setQuoteId(BANK_NAME);
+ int errorCode=7;
+ String message=null;
+ logger.log(Priority.INFO, "Found " + file.getAbsolutePath() );
+
+ try {
+ BankQuoteRequest bankQuoteRequest = new BankQuoteRequest();
+ //Read the content of the file into a String
+ message=FileUtil.readTextFile(file);
+ String[] messagePart = message.split(",");
+
+ errorCode=1;
+ bankQuoteRequest.setSsn(Integer.valueOf(messagePart[0]));
+ errorCode=2;
+ bankQuoteRequest.setCreditScore(Integer.valueOf(messagePart[1]));
+ errorCode=3;
+ bankQuoteRequest.setHistoryLength(Integer.valueOf(messagePart[2]));
+ errorCode=4;
+ bankQuoteRequest.setLoanAmount(Integer.valueOf(messagePart[3]));
+ errorCode=5;
+ bankQuoteRequest.setLoanTerm(Integer.valueOf(messagePart[4]));
+ errorCode=6;
+ bankQuoteRequest.setCustomerUID(String.valueOf(messagePart[5]));
+
+ Bank fileBasedBank = new Bank(BANK_NAME, RATE_PREMIUM, MAXLOANTERM);
+ bankQuoteReply = fileBasedBank.processMessage(bankQuoteRequest);
+ } catch (Throwable e) {
+ //Package up the error, so it can be processed
+ logger.log(Priority.ERROR, e.getMessage());
+ bankQuoteReply.setErrorCode(errorCode);
+ }
+
+ try {
+ //Create the outgoing response file
+ File outgoingDir = new File(file.getParent() + "/" + OUTGOING_DIR);
+ if (!outgoingDir.exists()) {
+ outgoingDir.mkdir();
+ }
+ File outgoingFile = new File(outgoingDir + "/" + PREFIX + file.getName());
+ logger.log(Priority.INFO, "Creating outgoing file " + outgoingFile.getAbsolutePath());
+ outgoingFile.createNewFile();
+ String reply=bankQuoteReply.getInterestRate() + "," + bankQuoteReply.getQuoteId() + ","
+ + bankQuoteReply.getErrorCode() + "," + bankQuoteReply.getCustomerUID();
+ logger.log(Priority.INFO, "Writing reply " + reply);
+ FileUtil.writeTextFile(outgoingFile, reply);
+
+ //Move the processed file away so it does not get processed again
+ File processedDir = new File(file.getParent() + "/" + PROCESSED_DIR);
+ if (!processedDir.exists()) {
+ processedDir.mkdir();
+ }
+ logger.log(Priority.INFO, "Moving file " + file.getName() + " to processed directory");
+ File processedFile = new File(processedDir.getAbsolutePath() + "/" + file.getName());
+ file.renameTo(processedFile);
+ if (file.exists()) {
+ file.delete();
+ }
+ } catch (Exception e) {
+ logger.log(Priority.ERROR, e.getMessage(), e);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ DOMConfigurator.configure("log4j.xml");
+ String monitoredDirectoryStr = "C:/Temp/BankInput";
+ if (args!=null && args.length > 0) {
+ monitoredDirectoryStr=args[0];
+ }
+ File monitoredDirectory = new File(monitoredDirectoryStr);
+ if (!monitoredDirectory.exists() || !monitoredDirectory.isDirectory()){
+ System.err.println("Invalid directory " + monitoredDirectory.getAbsolutePath());
+ System.out.println("Trying to create the directory.");
+ try {
+ monitoredDirectory.mkdir();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ }
+ }
+ DirectoryPoller poller = new DirectoryPoller(monitoredDirectory);
+ poller.addPollManager(new ManagerFlatFile());
+ poller.start();
+ }
+
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerJMS.java
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerJMS.java 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/banks/src/org/jboss/soa/esb/samples/loanbroker/banks/ManagerJMS.java 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.samples.loanbroker.banks;
+
+import java.math.BigDecimal;
+import java.util.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+import org.apache.log4j.xml.DOMConfigurator;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+/**
+ * The JMS Manager listens to an incoming queue (by default queue/A on localhost). It consumes the
+ * message assuming it is a TextMessage, and that the text is an XML structure that can be marshalled
+ * into a BankQuoteRequest. The request will be processed and a BankQuoteRequest Reply will be serialized to XML
+ * and send to the outgoing queue (by default this is queue/B on localhost).
+ *
+ * @author kstam
+ */
+public class ManagerJMS implements javax.jms.MessageListener {
+ private static Logger logger = Logger.getLogger(ManagerJMS.class);
+ /** Name of the Bank */
+ private static final String BANK_NAME = "JMSBasedBank";
+ /** Rate premium the bank charges */
+ private static final BigDecimal RATE_PREMIUM = BigDecimal.valueOf(0.50);
+ /** Maximum duration of the loan the bank will accept [months] */
+ private static final int MAXLOANTERM = 120;
+ /** Default incoming queue */
+ private static String QUEUE_IN = "queue/A";
+ /** Default outgoing queue */
+ private static String QUEUE_OUT = "queue/B";
+ /** Default jms provider url */
+ private static String PROVIDER_URL = "localhost";
+ /** Context used to lookup the Queues */
+ private static InitialContext ctx;
+ /** Properties used when constructing the InitialContext */
+ private static Properties properties = new Properties();
+ /** Queue connection for incoming queue */
+ QueueConnection inQueueConnection;
+
+ /**
+ * Sets up the queue listener. By default is listenes to queue/A on localhost.
+ */
+ public void listen() {
+ try {
+ properties.put(Context.INITIAL_CONTEXT_FACTORY,
+ "org.jnp.interfaces.NamingContextFactory");
+ properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
+ properties.put(Context.PROVIDER_URL, PROVIDER_URL);
+ ctx = new InitialContext(properties);
+ logger.info("Looking up queue=" + QUEUE_IN);
+ Queue inQueue = (Queue) ctx.lookup(QUEUE_IN);
+ logger.info("Looking up connection factory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) ctx
+ .lookup("UIL2ConnectionFactory");
+ logger.info("Creating connection");
+ inQueueConnection = qcf.createQueueConnection();
+ logger.info("Creating session");
+ QueueSession qs = inQueueConnection.createQueueSession(false,
+ Session.DUPS_OK_ACKNOWLEDGE);
+ QueueReceiver qr = qs.createReceiver(inQueue);
+ qr.setMessageListener(this);
+ inQueueConnection.start();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ /**
+ * Sets up the queue listener. By default is listenes to queue/A on localhost. It consumes the
+ * message assuming it is a TextMessage, and that the text is an XML structure that can be marshalled
+ * into a BankQuoteRequest. The request will be processed and a BankQuoteRequest Reply will be serialized to XML
+ * and send to the outgoing queue (by default this is queue/B on localhost). If the processing results
+ * in an error a BankQuoteReply with ErrorCode other then 0 is send to the outgoing queue.
+ *
+ * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
+ */
+ public void onMessage(Message message) {
+ QueueConnection outQueueConnection;
+ logger.info("Got message: " + message);
+ try {
+ TextMessage textMessage = (TextMessage) message;
+ String xml = textMessage.getText();
+ XStream xstream = new XStream(new DomDriver());
+ BankQuoteRequest bankQuoteRequest = new BankQuoteRequest();
+
+ xstream.fromXML(xml, bankQuoteRequest);
+ Bank bank = new Bank(BANK_NAME, RATE_PREMIUM, MAXLOANTERM);
+ BankQuoteReply bankQuoteReply = bank
+ .processMessage(bankQuoteRequest);
+ String bankQuoteReplyXML = xstream.toXML(bankQuoteReply);
+ Queue outQueue = (Queue) ctx.lookup(QUEUE_OUT);
+ logger.log(Priority.INFO, "Looking up connection factory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) ctx
+ .lookup("UIL2ConnectionFactory");
+ logger.log(Priority.INFO, "Creating connection");
+ outQueueConnection = qcf.createQueueConnection();
+ try {
+ logger.log(Priority.INFO, "Creating session");
+ QueueSession qs = outQueueConnection.createQueueSession(false,
+ Session.DUPS_OK_ACKNOWLEDGE);
+ TextMessage responseTextMessage = qs
+ .createTextMessage(bankQuoteReplyXML);
+ QueueSender queueSender = qs.createSender(outQueue);
+ queueSender.send(responseTextMessage);
+ } catch (JMSException je) {
+ logger.log(Priority.ERROR, je.getMessage(), je);
+ } finally {
+ outQueueConnection.close();
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ /**
+ * Closing the queue connection as to not leak connection resources.
+ */
+ public void close() throws JMSException {
+ inQueueConnection.close();
+ }
+ /**
+ * Invokes an instance of JMS based bank listener.
+ * @param args - provider url, queue_in, queue_out
+ */
+ public static void main(String[] args) {
+ if (args != null && args.length > 0) {
+ PROVIDER_URL = args[0];
+ if (args.length > 1) {
+ QUEUE_IN = args[1];
+ if (args.length > 2) {
+ QUEUE_OUT = args[2];
+ }
+ }
+ } else {
+ System.out.println(
+ "Usage: ManagerJMS providerURL, queueIn, queueOut");
+ }
+ System.out.println("Starting JMS Bank Listener...");
+ System.out.println("Provider URL='" + PROVIDER_URL + "'.");
+ System.out.println("Listening to Queue '" + QUEUE_IN + "'.");
+ System.out.println("Responding to Queue '" + QUEUE_OUT + "'.");
+ DOMConfigurator.configure("log4j.xml");
+ ManagerJMS managerJMS = new ManagerJMS();
+ managerJMS.listen();
+ }
+}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/samples/trailblazer2/build.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/build.properties 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/build.properties 2006-11-29 00:17:40 UTC (rev 7912)
@@ -1,2 +1,2 @@
-org.jboss.soa.samples.trailblazer.jboss_home=/home/dbrum/jboss-4.0.4
-org.jboss.soa.samples.trailblazer.jboss_server=default
+org.jboss.soa.samples.trailblazer.jboss_home=C:/dev/jboss4.0.5
+org.jboss.soa.samples.trailblazer.jboss_server=default
Modified: labs/jbossesb/trunk/product/samples/trailblazer2/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/build.xml 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/build.xml 2006-11-29 00:17:40 UTC (rev 7912)
@@ -207,7 +207,7 @@
<target name="runESB" depends="jar">
<echo>Running ESB Trailblazer listeners</echo>
<java fork="yes" classname="org.jboss.soa.esb.samples.trailblazer.util.Launcher" failonerror="true"
- args="600 ${basedir}/esb/conf/loanbroker-esb.xml">
+ args="600 ${basedir}/esb/conf/loanbroker-esb.xml ${basedir}/esb/conf/banksgateway-esb.xml">
<classpath refid="org.jboss.esb.samples.trailblazer.esb.classpath.run"/>
</java>
</target>
Added: labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/from__loanbroker.cdrl
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/from__loanbroker.cdrl 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/from__loanbroker.cdrl 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<!DOCTYPE smooks-resource-list PUBLIC '-//MILYN//DTD SMOOKS 1.0//EN' 'http://milyn.org/dtd/smooksres-list-1.0.dtd'>
+
+<smooks-resource-list>
+
+ <!--
+ Bank Quotes from the loan broker are always in CSV format. Need to enable a CSV to SAX parser
+ to enable transformation of these messages.
+
+ See: http://milyn.codehaus.org/javadoc/smooks-cartridges/csv/org/milyn/csv/CSVParser.html
+ -->
+ <smooks-resource useragent="type:BankQuote-CSV AND from:LoanBroker" selector="org.xml.sax.driver" path="org.milyn.csv.CSVParser" >
+ <param name="fields" type="string-list">ssn,creditScore,creditHistoryLen,amount,term,customerUniqueId</param>
+ </smooks-resource>
+
+</smooks-resource-list>
Added: labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/smooks-cdr.lst 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/smooks-cdr.lst 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,31 @@
+#################################################################################################################################################
+#
+# OVERVIEW:
+# =========
+# This is the Smooks configuration file "list file" i.e. it lists all the Smooks resource configuration files. One should think of these
+# configuration files as being the Smooks configuration database. These configurations may/will eventually be maintained in a database
+# with a graphical UI to aid comprehension.
+#
+# THINGS TO NOTE:
+# ===============
+# 1. Don't try to apply any significance to the fact that there are multiple .cdrl files. This does not mean they are
+# separate transformations. All these files are loaded by Smooks to make up a "database" of transformation
+# resource configurations. Smooks will dynamically select the resource configurations that apply in a given situation
+# based on the profiles associated with the requested transformation "useragent" e.g. message type, message producer,
+# message consumer.
+#
+# 2. The .cdrl list entries in this file are resource references on the *classpath* i.e. they're not filesystem paths.
+# These .cdrl files should all be located in the "transform" folder.
+#
+#################################################################################################################################################
+
+################################################################################
+# Message transformation resource definitions
+################################################################################
+/from__loanbroker.cdrl
+/to____jmsbank.cdrl
+
+################################################################################
+# Common transformation support resource definitions.
+################################################################################
+/org/milyn/templating/templating-cdu-creators-0.1.cdrl
Added: labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/to____jmsbank.cdrl
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/to____jmsbank.cdrl 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/client/resources/to____jmsbank.cdrl 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,40 @@
+<?xml version='1.0'?>
+<!DOCTYPE smooks-resource-list PUBLIC '-//MILYN//DTD SMOOKS 1.0//EN' 'http://milyn.org/dtd/smooksres-list-1.0.dtd'>
+
+<smooks-resource-list>
+
+ <!--
+ 1. Bank Quotes from the loan broker are always XML'ified CSV records.
+ See from__loanbroker.cdrl
+ 2. The JMSBank needs this data as XML, but the XML produced by CSVParser needs the following
+ modifications:
+ i) A general restructuring of the <csv-record> elements to fit the format requirements of the JMSBank.
+ (See http://milyn.codehaus.org/javadoc/smooks-cartridges/templating/org/milyn/templating/xslt/XslContentDeliveryUnitCreator.html)
+ ii) Remove the root <csv-set>. We know that there's only one CSV record in this set and the JMSBank
+ expects the root to be "org.jboss.soa.esb.samples.loanbroker.banks.BankQuoteRequest".
+ (See http://milyn.codehaus.org/javadoc/smooks-cartridges/misc/org/milyn/cdres/trans/RemoveElementTU.html)
+ Note of course that this particular transformation could be easily avoided by simply targeting the XSLT
+ transformation at the <csv-set> element. However, if multiple <csv-record> elements were present and
+ supported by the JMS Bank, a configuration like this would be more appropriate - the only difference being
+ that the <csv-set> would more like get renamed than removed.
+ -->
+ <smooks-resource useragent="type:BankQuote-CSV AND from:LoanBroker AND to:JMSBank" selector="csv-record">
+ <param name="restype">xsl</param>
+ <param name="resdata">
+ <![CDATA[
+ <org.jboss.soa.esb.samples.loanbroker.banks.BankQuoteRequest>
+ <ssn><xsl:value-of select="ssn"/></ssn>
+ <creditScore><xsl:value-of select="creditScore"/></creditScore>
+ <historyLength><xsl:value-of select="creditHistoryLen"/></historyLength>
+ <loanAmount><xsl:value-of select="amount"/></loanAmount>
+ <loanTerm><xsl:value-of select="term"/></loanTerm>
+ <customerUID><xsl:value-of select="customerUniqueId"/></customerUID>
+ </org.jboss.soa.esb.samples.loanbroker.banks.BankQuoteRequest>
+ ]]>
+ </param>
+ </smooks-resource>
+ <smooks-resource useragent="type:BankQuote-CSV AND from:LoanBroker AND to:JMSBank" selector="csv-set" path="org.milyn.cdres.trans.RemoveElementTU">
+ <param name="keepChildContent">true</param>
+ </smooks-resource>
+
+</smooks-resource-list>
Added: labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/banksgateway-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/banksgateway-esb.xml 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/banksgateway-esb.xml 2006-11-29 00:17:40 UTC (rev 7912)
@@ -0,0 +1,18 @@
+<jms-banks-gateway parameterReloadSecs="180">
+ <esb-jms-gateway
+ target-service-category="trailblazer"
+ target-service-name="jmsbank"
+ gatewayClass="org.jboss.soa.esb.listeners.gateway.JmsGatewayListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/A"
+ jndi-type="jboss"
+ jndi-URL="localhost"
+ message-selector="service='jmsbankresponse'"
+ >
+ <!-- no action needed as the inbound message is automatically converted
+ and sent to the queue for the target service"product/samples/trailblazer2/build.xml"
+ -->
+ </esb-jms-gateway>
+</jms-banks-gateway>
+"product/samples/trailblazer2/build.xml"
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml 2006-11-28 23:45:42 UTC (rev 7911)
+++ labs/jbossesb/trunk/product/samples/trailblazer2/esb/conf/loanbroker-esb.xml 2006-11-29 00:17:40 UTC (rev 7912)
@@ -20,6 +20,20 @@
to-epr="trailblazer:creditcheck" -->
- </CreditCheck>
+ </CreditCheck>
+
+ <JMSBankResponse
+ service-category="trailblazer"
+ service-name="jmsbank"
+ listenerClass="org.jboss.soa.esb.listeners.message.JmsQueueListener"
+ connection-factory="ConnectionFactory"
+ destination-type="queue"
+ destination-name="queue/A"
+ jndi-type="jboss"
+ jndi-URL="localhost"
+ message-selector="service='jmsbankresponse'"
+ maxThreads="1">
+
+ </JMSBankResponse>
</Trailblazer>
More information about the jboss-svn-commits
mailing list