# AccountPublishJMSControl.jcx Sample

This topic inludes the source code for the AccountPublishJMSControl.jcx Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/jms/

## Sample Source Code

`01 package jms; 02 03 import com.bea.control.JMSControl; 04 import com.bea.control.ControlExtension; 05 import java.io.Serializable; 06 import org.openuri.bea.samples.workshop.jms.account.AccountTransactionDocument; 07 import org.openuri.bea.samples.workshop.jms.account.AccountTransactionDocument.AccountTransaction; 08 09 /** 10 * <p>JMS control used by AccountPublish.jws sample. Defines 11 * <b>deposit</b> and <b>withdraw</b> methods that publish 12 * appropriately formatted messages to the JMS topic 13 * <tt>jms.AccountUpdate</tt>.</p> 14 * 15 * <p>Notice that this control specifies a value for 16 * send-jndi-name but not for receive-jndi-name since 17 * this control is only used to publish messages.<p> 18 * 19 * @jc:jms 20 * send-type="topic" 21 * send-jndi-name="jms.AccountUpdate" 22 * connection-factory-jndi-name="weblogic.jws.jms.QueueConnectionFactory" 23 */ 24 public interface AccountPublishJMSControl extends ControlExtension, JMSControl 25 { 26 /** 27 * <p><b>deposit</b> encodes the transaction information into 28 * message properties (containing the transaction type and 29 * account ID) and the message body (containing the transaction 30 * amount).</p> 31 * 32 * @jc:jms-property key="accountIdentifier" value="{accountID}" 33 * @jc:jms-property key="transactionType" value="DEPOSIT" 34 * 35 */ 36 public void deposit(AccountTransaction transaction, String accountID); 37 38 /** 39 * <p><b>withdraw</b> encodes the transaction information into 40 * message properties (containing the transaction type and 41 * account ID) and the message body (containing the transaction 42 * amount).</p> 43 * 44 * @jc:jms-property key="accountIdentifier" value="{accountID}" 45 * @jc:jms-property key="transactionType" value="WITHDRAW" 46 * 47 */ 48 public void withdraw(AccountTransaction transaction, String accountID); 49 50 }`