ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General Discussion » PubSub Applications and Some Confusion

Post new topic  Reply to topic Goto page Previous  1, 2
 PubSub Applications and Some Confusion « View previous topic :: View next topic » 
Author Message
vennela
PostPosted: Fri May 19, 2006 1:17 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

applejuice wrote:
Any suggestion how can i run it locally/or say if I have a full blown server setup on another computer in the network?


That you can do.

alt tcf(ma0cTCF) QMANAGER(<your QMGR Name>) TRANSPORT(CLIENT) CHANNEL(SYSTEM.DEF.SVRCONN) PORT(1414) HOSTNAME(lesentsvr06)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
applejuice
PostPosted: Fri May 19, 2006 2:06 pm    Post subject: Reply with quote

Novice

Joined: 19 May 2006
Posts: 12

thanks guys a million for your patience. I'll setup an MQ server on another computer and give it a sot and get back to you with more whining after the long weekend hopefully. One little question I heard clients use JNDI interface for ldap authentication if the server is on a different computer, but i don't want an ldap server, i want regular tcp/ip connection. is it possible to bypass JNDI totally?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 19, 2006 5:12 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

applejuice wrote:
thanks guys a million for your patience. I'll setup an MQ server on another computer and give it a sot and get back to you with more whining after the long weekend hopefully. One little question I heard clients use JNDI interface for ldap authentication if the server is on a different computer, but i don't want an ldap server, i want regular tcp/ip connection. is it possible to bypass JNDI totally?

You don't want to bypass JNDI totally. Not if you want to become proficient in JMS. However you do not HAVE to use JNDI and LDAP for authentication.
You can use simple client authentication:
Code:
myconn = tcf.createConnection(user, passwd);

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
applejuice
PostPosted: Tue May 23, 2006 1:55 pm    Post subject: Reply with quote

Novice

Joined: 19 May 2006
Posts: 12

hi guys. hope you had a good weekend. I got my mqjmspub.java and mqjmssub.java programs running. But the output is not what I expected. I can publish a message fine using mqjmspub program (which is connecting to a queue manager on someserver on port 1414) but when i run mqjmssub, it doesn't show any topic content. the program stops at 'Hit enter to end..' the 'inMessage:' part doesn't show. I cheked my connection/context definition everything looks okay. What might be causing this (my friend browsed the server queue and couldn't find any published message either) One more question how can I subscribe to an existing topic say
Code:
/mytopic/is/right/here/to/subscribe/
when I define the topic like this:
Code:
def t(ma0cTopic) topic(SYSTEM.JMS.D.mytopic/is/right/here/to/subscribe/)
I get some kind of prefix error. what is the exact syntax to do so? any help is much appreciated
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed May 24, 2006 12:10 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Your topic looks like it is trying to specify both the queue name and the actual topic name. Try something simpler. You could define the following through JMSAdmin:

def t(Sport.Baseball.Score) topic(/Sport/Baseball/Score)

The subscriber would then use the Sport.Baseball.Score and the publisher could use an input string of:

33;/Sport/Baseball/Score;asdfadsf
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
applejuice
PostPosted: Wed May 24, 2006 12:27 pm    Post subject: Reply with quote

Novice

Joined: 19 May 2006
Posts: 12

Thanks. What if i just know the topic name say (/sports/baseball/score) and I want to subscribe to it. In than case I don't need the publisher (mqjmspub.java) In that case how do I create the context facory (or .bindings file) using JMSConfig to subscribe to (/sports/baseball/score) using mqjmssub.java. Do iI have to know which particular queue it is on in the main MQ server? what if I have limited access to the server and I can run any commands to browse the queue (I'm not sure how the server part work, just guessing). Thanks in advance.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 24, 2006 12:29 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You have to have a publisher to actually produce the messages that will arrive at the subscribers!

You have to have a registered subscriber on a topic for a published message to be sent anywhere.

The process of registering the subscriber is what associates a particular queue with messages on a particular topic.

Read the following link in it's ENTIRETY before posting more questions, thanks!

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.amqnar.doc/amqnar10.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
applejuice
PostPosted: Wed Jun 14, 2006 6:03 am    Post subject: Reply with quote

Novice

Joined: 19 May 2006
Posts: 12

Hey guys

I got my sample mqjmspub.java/mqjmssub.java applications working. Pub can post messages on a remote queue, if sub is running it can fetch the message and print it on a console. both pub and sub is running on local machine.

Now I just want to use Subscriber (mqjmssub.java) and subscribe to a topic that was already posted or being posted frequestly by someone else (someother publisher) how do I configure my JMSAdmin and mqjmssub.property file to do this, here's what I have on my surrent settings. I just know the name of the topic which is: REL/CURRENT/ARTIST/EARNINGS/EST_JACKPOT


**************************************
JMSAdmin definition of sample sports topic)

**************************************

InitCtx> def ctx(pubsub)

InitCtx> chg ctx(pubsub)


InitCtx/pubsub> def tcf(ma0cTCF) qmgr(MQSI.LBKAT01.QM) clientid(arif)

InitCtx/pubsub> alt tcf(ma0cTCF) QMANAGER(MQSI.LBKAT01.QM) TRANSPORT(CLIENT) CHA
NNEL(SYSTEM.DEF.SVRCONN) PORT(1414) HOSTNAME(lesentsvr06)

InitCtx/pubsub> def t(ma0cTopic) topic(sports)

InitCtx/pubsub> alt t(ma0cTopic) BROKERDURSUBQ(SYSTEM.JMS.D.SPORTS.*)


InitCtx/pubsub> alt t(ma0cTopic) DESCRIPTION(For sample programs)


InitCtx/pubsub> dis t(ma0cTopic)

BROKERPUBQMGR()
FAILIFQUIESCE(YES)
BROKERDURSUBQ(SYSTEM.JMS.D.SPORTS.*)
TOPIC(sports)
BROKERPUBQ()
BROKERVER(V1)
PERSISTENCE(APP)
CCSID(1208)
DESCRIPTION(For sample programs)
TARGCLIENT(JMS)
ENCODING(NATIVE)
BROKERCCDURSUBQ(SYSTEM.JMS.D.CC.SUBSCRIBER.QUEUE)
MULTICAST(ASCF)
PRIORITY(APP)
EXPIRY(APP)
VERSION(6)



InitCtx/pubsub> dis tcf(ma0cTCF)

CCSID(819)
BROKERSUBQ(SYSTEM.JMS.ND.SUBSCRIBER.QUEUE)
PORT(1414)
SYNCPOINTALLGETS(NO)
PUBACKINT(25)
POLLINGINT(5000)
RECEIVEISOLATION(COMMITTED)
MSGSELECTION(CLIENT)
OUTCOMENOTIFICATION(YES)
CHANNEL(SYSTEM.DEF.SVRCONN)
OPTIMISTICPUBLICATION(NO)
BROKERCONQ(SYSTEM.BROKER.CONTROL.QUEUE)
USECONNPOOLING(YES)
HOSTNAME(lesentsvr06)
CLONESUPP(DISABLED)
SPARSESUBS(NO)
VERSION(6)
BROKERCCSUBQ(SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE)
PROCESSDURATION(UNKNOWN)
SSLRESETCOUNT(0)
CONNOPT(STANDARD)
BROKERQMGR()
SSLFIPSREQUIRED(NO)
FAILIFQUIESCE(YES)
CLEANUP(SAFE)
RESCANINT(5000)
MSGBATCHSZ(10)
BROKERPUBQ(SYSTEM.BROKER.DEFAULT.STREAM)
QMANAGER(MQSI.LBKAT01.QM)
BROKERVER(V1)
CLEANUPINT(3600000)
STATREFRESHINT(60000)
SUBSTORE(MIGRATE)
TRANSPORT(CLIENT)
TARGCLIENTMATCHING(YES)
CLIENTID(applejuice)

InitCtx/pubsub>


****************************************************
mqjmssub.property file
****************************************************
icf=com.sun.jndi.fscontext.RefFSContextFactory
url=file:/C:/JMSConfig
tcf=\\pubsub\\ma0cTCF
t=\\pubsub\\ma0cTopic
d=SUB


any help is much appreciated. thanks guys
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jun 14, 2006 10:46 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

applejuice wrote:
I just know the name of the topic which is: REL/CURRENT/ARTIST/EARNINGS/EST_JACKPOT


applejuice wrote:
InitCtx/pubsub> def t(ma0cTopic) topic(sports)

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
applejuice
PostPosted: Wed Jun 14, 2006 11:41 am    Post subject: Reply with quote

Novice

Joined: 19 May 2006
Posts: 12

stupid me

Thanks jeff. Its working great!
Back to top
View user's profile Send private message
applejuice
PostPosted: Tue Jun 20, 2006 7:21 am    Post subject: Reply with quote

Novice

Joined: 19 May 2006
Posts: 12

Hi guys again. I was trying to create a stanadlone durable subscriber/unsubscriber app. Any idea?

this is what i get:
C:\>java durClient -t MY/PATH/TO/TOPIC -d noah
durClient started....
tSub creation exception: javax.jms.InvalidDestinationException: MQJMS0003: Desti
nation not understood or no longer valid

/////////////////////this is my code///////////////////////////
Code:

import java.lang.*;
import java.io.*;
import java.util.*;
import java.text.*;
import javax.jms.*;
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;
import java.util.Properties;

public class durClient{

private static Context ctx = null;
private static String icf = null;
private static String url = null;
private static String lookupTCF = null;
private static String lookupTopic = null;
private static String durableID = null; //create durable subscriber
private static String deldurID = null; //delete durable subscriber


public durClient() {

/***********************************************/
/* We'll get anything with the -D syntax first */
/***********************************************/
url = System.getProperty("url");
icf = System.getProperty("icf");
lookupTopic = System.getProperty("t");
lookupTCF = System.getProperty("tcf");
durableID = System.getProperty("d"); //subscribe
deldurID = System.getProperty("u"); //unsuscribe



try {
Properties props = new Properties(System.getProperties());
props.load(new BufferedInputStream(new FileInputStream("defaultsub.properties")));
System.setProperties(props);
} catch (Exception e) {
System.out.println("Unable to read defaultsub.properties:");
System.out.println(" " + e);
System.err.println(e);
}

/******************************************************/
/* If any of the necessary properties are null, we'll */
/* take the value from the file since they weren't */
/* specified with -D. */
/******************************************************/

if (url == null) {url = System.getProperty("url");}
if (icf == null) {icf = System.getProperty("icf");}
if (lookupTCF == null) {lookupTCF = System.getProperty("tcf");}
if (lookupTopic == null) {lookupTopic = System.getProperty("t");}
if (durableID == null) {durableID = System.getProperty("d");}



}

public durClient(String[] args) {

this();


for( int i=0; i<args.length; i++ ) {
String arg = args.toLowerCase();

if( arg.equals("-url") )
{
if ( i+1><args.length )
{
url = args[++i];
}
else {
System.out.println("didn't specify url, exiting");
return;
}

} else if( arg.equals("-icf") ) {
if ( i+1><args.length ) {
icf = args[++i];
} else {
System.out.println("didn't specify icf, exiting");
return;
}

} else if( arg.equals("-tcf") ) {
if ( i+1><args.length ) {
lookupTCF = args[++i];
} else {
System.out.println("didn't specify tcf, exiting");
return;
}

} else if( arg.equals("-t") ) {
if ( i+1><args.length ) {
lookupTopic = args[++i];
} else {
System.out.println("didn't specify topic, exiting");
return;
}

} else if( arg.equals("-d") ) {
if ( i+1><args.length ) {
durableID = args[++i];
} else {
System.out.println("didn't specify durableID, exiting");
return;
}

} else {
System.out.println( "Unknown argument: " + arg );
}

}

}

public void mySubscriber() {
Topic topic = null;
TopicSession session = null;
TopicConnection connection = null;
TopicConnectionFactory factory = null;
String myPublish = null;

System.out.println("durClient started....");




Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, icf);
environment.put(Context.PROVIDER_URL, url);
environment.put(Context.REFERRAL, "throw");
try {
ctx = new InitialDirContext( environment );
} catch( Exception e ) {
System.err.println("Error during lookup of Context Factory " + e);
System.err.println(e);
return;
}


try {
factory = (TopicConnectionFactory)ctx.lookup(lookupTCF);
} catch( Exception e ) {
System.out.println("TCF Lookup error: " + e);
System.err.println(e);
return;
}

TopicSubscriber tSub = null;
try {


connection = factory.createTopicConnection();


boolean transacted = false;
session = connection.createTopicSession(transacted,
Session.AUTO_ACKNOWLEDGE);



connection.start();


if (durableID != null && deldurID == null) {
tSub = session.createDurableSubscriber(topic, durableID);
System.out.println("created subscriber.");
} else if (durableID == null && deldurID != null) {
System.out.println(" Removing subscriber!");
session.unsubscribe(deldurID);
} else System.out.println("Insufficient Parameters");

} catch( JMSException je ) {
System.out.println("tSub creation exception: " + je);
Exception le = je.getLinkedException();
if (le != null) {
System.out.println("Linked exception: " + le);
}
try {
session.close();
connection.close();
} catch ( JMSException je2) {
System.out.println("JMS exception on closing: " + je2);
Exception le2 = je2.getLinkedException();
if (le2 != null) {
System.out.println("Linked exception: " + le2);
}
}
return;
}





}



public static void main( String[] args )
{
durClient app = new durClient(args);

/***************************************************************/
/* Check that all arguments were entered. */
/* -d is optional; only needed if subscriber will be durable */
/***************************************************************/
if ( (icf==null)
|| (url==null)
|| ( (lookupTopic==null) && lookupTCF==null) ) {
System.out.println("Usage:");
System.out.println("java durClient -t ... -d ...");
System.out.println("where -t is the topic");
System.out.println(" -d is the durable id");
System.out.println(" -u is the durable id unsubscription");


} else app.mySubscriber();
}

}//end class
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » General Discussion » PubSub Applications and Some Confusion
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.