Package javax.naming

Examples of javax.naming.Context


  public static void main(String[] args) throws Exception {
    System.out.println();
    System.out.println("Listens to the monitoring topic...");

    Context ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("MonitoringTopic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer subs = sess.createConsumer(topic);
View Full Code Here


*/
public class DMQWatcher {
  public static void main(String[] args) throws Exception {
    System.out.println("Listens to the dead message queue...");

    Context ictx = new InitialContext();
    Queue dmq = (Queue) ictx.lookup("dmq");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection("anonymous", "anonymous");

    Session session = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = session.createConsumer(dmq);
View Full Code Here

      JoramAdapter ja= new JoramAdapter() ;
     
      ja.start(bt);
      System.out.println("start ...");
    
      Context ictx = new InitialContext();
      Queue queue = (Queue) ictx.lookup("queue");
      Topic topic = (Topic) ictx.lookup("topic");
    
      ictx.close();

      ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
      mcf.setResourceAdapter(ja);
      System.out.println("ManagedConnectionFactoryImpl ok");
    
View Full Code Here

/**
* Producer/Consumer generating dead messages.
*/
public class DMQClient {
  public static void main(String[] args) throws Exception {
    Context ictx = new InitialContext();
    Queue queue1 = (Queue) ictx.lookup("queue1");
    Queue queue2 = (Queue) ictx.lookup("queue2");
//    Queue queue3 = (Queue) ictx.lookup("queue3");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session prodSession = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Session consSession = cnx.createSession(true, 0);
   
View Full Code Here

import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.Session;

public class AConsumer {
  public static void main(String[] args) throws Exception {
    Context context = new InitialContext();
    ConnectionFactory cf = (ConnectionFactory) context.lookup("cf");
    javax.jms.Queue queue =(Queue)context.lookup("queue");
    context.close();
   
    Connection cnx = cf.createConnection();
    Session session = (Session) cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
//    session.setImplicitAck(true);
    session.setQueueMessageReadMax(100);
View Full Code Here

    MessageProducer  producer = null;
    TextMessage message = null;
    Queue queue = null;
    ConnectionFactory cf = null;

    Context initialContext = new InitialContext();
    cf = (ConnectionFactory) initialContext.lookup("cf");
    queue = (Queue) initialContext.lookup("queue");
    initialContext.close();

    cnx = cf.createConnection();
   
    session = cnx.createSession(true, Session.AUTO_ACKNOWLEDGE);
    cnx.start();
View Full Code Here

    try {
      Destination dest;
     
      try {
        Context ctx = new InitialContext();
        dest = (Destination) ctx.lookup(destName);
      } catch (javax.naming.NamingException exc) {
        String shortName = removePrefix(destName);
        if ("javax.jms.Queue".equals(destType))
          dest = AdminModule.createQueue(serverId,
                                         shortName,
View Full Code Here

                            String className,
                            Properties prop) throws AdminException, ConnectException {
    Queue queue = null;

    try {
      Context ctx = new InitialContext();
      queue = (Queue) ctx.lookup(name);
    } catch (javax.naming.NamingException exc) {
      String shortName = removePrefix(name);
      queue = (Queue) AdminModule.createQueue(serverId, shortName, className, prop);
      queue.setFreeReading();
      queue.setFreeWriting();
View Full Code Here

                            String className,
                            Properties prop) throws AdminException, ConnectException {
    Topic topic = null;

    try {
      Context ctx = new InitialContext();
      topic = (Topic) ctx.lookup(name);
    } catch (javax.naming.NamingException exc) {
      String shortName = removePrefix(name);
      topic = (Topic) AdminModule.createTopic(serverId, shortName, className, prop);
      topic.setFreeReading();
      topic.setFreeWriting();
View Full Code Here

   *
   * @param name       The JNDI name of the destination.
   */
  public void removeDestination(String name) throws AdminException {
    try {
      Context ctx = new InitialContext();
      Destination dest = (Destination) ctx.lookup(name);
      ctx.close();

      dest.delete();
      unbind(name);
    } catch (Exception exc) {
      logger.log(BasicLevel.WARN,
View Full Code Here

TOP

Related Classes of javax.naming.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.