Results 1 to 6 of 6
  1. #1
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Default MessageDrivenBean

    Following the payment method invocation (), the bean Shopping sends a message containing the amount to be paid and the customer's bank details (RIB) to a trusted part (TrustPayement). This injects the GestionBancaire and debit the balance amount of the corresponding customer.
    Implement the MDB (TrustPayement) that provides this functionality.

    ------------------------
    Frensh :

    Suite à l’invocation de la méthode payement(), le bean Shopping envoie un message contenant le montant à payer ainsi que le RIB du client à une partie de confiance (TrustPayement). Ce dernier injecte le GestionBancaire et débite le montant du solde du client correspondant.
    Implanter le MDB (TrustPayement) qui assure cette fonctionnalité.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  3. #3
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Default

    I have already two beans ( BankAccount and BankCustomer ) and a session ( BankManagement) //" GestionBancaire " in frensh
    It's an e-commerce web site.
    I need, now, how I impliment the method payement and how I imlements the message driven bean to ensure TrustPayement.
    =)

  4. #4
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Default

    I have a pakage " ecommerce" contains two folders : 1)° beans ( BankAccount.java, BankCustomer.java, BankManagement.java and BankManagementRemote.java ) //BankManagement = " GestionBancaire " in frensh
    2)° Customer ( Customer.java)
    // customer = " client " in frensh
    It's an e-commerce web site.
    I need, now, know how I impliment the method payement and how I imlement the message driven bean to ensure TrustPayement.
    =)
    thank you

  5. #5
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Default

    this is what I've done
    -----------------------------------------------
    TrustPayement.java
    ----------------------------------------------

    package TrustPayement.bean;

    import java.util.StringTokenizer;

    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.MessageDriven;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import org.jboss.ejb3.annotation.Depends;
    import javax.ejb.MessageDrivenContext;
    import java.util.*;

    @MessageDriven(activationConfig =
    {
    @ActivationConfigProperty(propertyName="destinatio nType", propertyValue="javax.jms.Queue"),
    @ActivationConfigProperty(propertyName="destinatio n", propertyValue="queue/exemple")//JNDI name
    })
    @Depends ("jboss.mq.destination:service=Queue,name=exempleM DB")



    public class TrustPayement implements MessageListener
    {

    @EJB
    private Gestion_bancaire.bean.GestionBancaire GB;
    public void onMessage(Message recvMsg)
    {
    String msg="";
    try{
    msg=((javax.jms.TextMessage)recvMsg).getText();
    StringTokenizer st=new StringTokenizer(msg,":");
    String part1= Double.parseDouble( st.nextToken());
    String part2= Long.parseLong(st.nextToken());
    GB.Retrait_Argent(part1,part2);
    }catch (javax.jms.JMSException e) {System.out.println("Erreur de reception");}


    System.out.println("----------------");
    System.out.println("Le message recu est : " + msg);
    System.out.println("----------------");
    }

    }
    ------------------------------
    this is my method
    -------------------------------
    public boolean paiement()
    {
    long RIB=1;
    QueueConnection cnn = null;
    QueueSender sender = null;
    QueueSession session = null;
    try
    {
    processMessage("queue/exemple");
    InitialContext ctx = new InitialContext();
    Queue queue = (Queue) ctx.lookup(queueBinding);
    QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
    cnn = factory.createQueueConnection();
    session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

    TextMessage msg = session.createTextMessage(RIB+""+getTotal());

    sender = session.createSender(queue);
    sender.send(msg);
    System.out.println("Message envoye avec succes a " + queueBinding);
    }
    finally
    {
    //cleanup
    if (cnn != null)
    {
    cnn.close();
    }

    }
    }
    return true;
    }

  6. #6
    jockhip12 is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Default

    what is this error ?

    fileset doesn't support the nested "fileset" element.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •