JMS Action group in MII Workbench - Dashboard - Community Wiki



JMS Action group in MII WorkbenchYou use this group of actions to communicate with a Java Message Service (JMS) server. This can be used for integration to other third party applications that use the JMS standard. The JMS API is a messaging standard that allows application components based on the Java 2 Platform, Enterprise Edition (J2EE) to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous.The JMS actions in MII Workbench include the following:Queue WriteQueue ReadTopic PublishThe JMS Queue actions provide a generic system to system interface that can be used to pass unstructured messages between. For example if a customer already has JBoss or other Application servers running in their environment. It also allows for asynchronous messaging between scheduled transactions and can be used to integrate with MSMQ for mobile device notifications.The JMS Topic Publish action can be used to asynchronously notify subscribed endpoints of a change in conditions on the shop-floor by feeding data to a UI that supports JMS Topic subscriptions (i.e.: MS Silverlight, Adobe Flash). This allows the system to push content to user(s) rather than have the user pages poll the backend systems for changes.Queue WriteYou use this action to send text-based messages to an existing queue on a Java Message Service (JMS) server. The following table lists the properties for the JMS Queue Write action:NamePropertyData TypeDefault valueAccessUseConnection AliasConnPropAliasStringIn and outIdentifies the JMS Connection alias that you want to use. This property is not mandatory – you can choose to use an alias or enter the connection details for the action manually. In case when you select an alias the URL, JNDI Context Provider and JNDI Factory Context are filled during the runtime automatically with the data from the alias. If you do not choose an alias than you should fill them with proper data. You can manage the JMS Connection aliases through System Connection Editor. URLJndiUrlStringIn and outSpecifies the URL for the JNDI service provider. You can find information how to construct the URL for connection to the SAP NetWeaver JNDI service provider in Creating an Initial Context -> Connection via the ICM and/or Connection via the Message Server. AS Java Ports provides a list of ports used by SAP NetWeaver.JNDI Context ProviderJndiContextProviderStringIn and outIdentifies the initial context factory to use. The value of the property should be the fully qualified class name of the factory class that will create an initial context. To connect to the SAP NetWeaver JNDI Registry Service, you have to use the following initial context factory class name: com.sap.engine.services.jndi.InitialContextFactoryImpl. JNDI Factory ContextJndiFactoryContextStringIn and outIdentifies the connection factory to use. Specifies the name that will be used for the lookup of the factory class that will create connections with a point to point JMS provider. In case you will send messages to the SAP NetWeaver JMS provider you can use the following name: jmsfactory/default/QueueConnectionFactory. To see all available connection factories in SAP NetWeaver you have to Open SAP NetWeaver AdministratorChoose Configuration Management -> Infrastructure -> JMS Server ConfigurationEnter “JMS Connection Factory” as a Type filter in the filters row and press enterThe table will show the available JMS Connection FactoriesJNDI Credential AliasJndiCredentialAliasStringIn and outSpecifies the alias for the user name and password that will be used for the creation of the JNDI context. You can use the Credential Editor to manage the credential aliases.Queue Credential AliasQueueCredentialAliasStringIn and outSpecifies the alias to the identity that will be used to create a JMS queue connection. You can use the Credential Editor to manage the credential aliases.Queue NameQueueNameStringIn and outSpecifies the name of the queue to write to.Message ExpirationMessageExpirationLong5000In and outSpecifies the message lifetime in milliseconds. The message is destroyed after the specified expiration time. If the value is set to 0 the message will never expire.Delivery ModeDeliveryModeInt2In and outSpecify the delivery mode for the message. There are two available modes: Persistent (value = 1), where the message is persisted to the database until the send attempt is successful. This ensures that the message won’t be lost in case of JMS provider failure. Non Persistent (value = 2), message is not persisted and thus its delivery is not guarantee in case of a failure during the delivery attempts. The default delivery mode is Non Persistent.PriorityPriorityInt4In and outSpecifies the priority of the message. The level of priority range from 0 (low) to 9 (highest). The default priority level is 4.MessageMessageStringIn and outSpecifies the message body.SuccessBooleanOutIndicates whether the action succeeded or failed. If it failed, errors are displayed in the server trace log.Queue ReadYou use this action to read text-based messages from an existing queue on a Java Message Service (JMS) server. This action attempts to synchronously read from the queue. The following table lists properties for the JMS Queue Read action:NamePropertyData TypeDefault valueAccessUseConnection AliasConnPropAliasStringIn and outIdentifies the JMS Connection alias that you want to use. This property is not mandatory – you can choose to use an alias or enter the connection details for the action manually. In case when you select an alias the URL, JNDI Context Provider and JNDI Factory Context are filled during the runtime automatically with the data from the alias. If you do not choose an alias than you should fill them with proper data. You can manage the JMS Connection aliases through System Connection Editor. URLJndiUrlStringIn and outSpecifies the URL for the JNDI service provider. You can find information how to construct the URL for connection to the SAP NetWeaver JNDI service provider in Creating an Initial Context -> Connection via the ICM and/or Connection via the Message Server. AS Java Ports provides a list of ports used by SAP NetWeaver.JNDI Context ProviderJndiContextProviderStringIn and outIdentifies the initial context factory to use. The value of the property should be the fully qualified class name of the factory class that will create an initial context.To connect to the NetWeaver JNDI Registry Service, you have to use the following initial context factory class name: com.sap.engine.services.jndi.InitialContextFactoryImpl.JNDI Factory ContextJndiFactoryContextStringIn and outIdentifies the connection factory to use. Specifies the name that will be used for the lookup of the factory class that will create connections with a point to point JMS provider. In case you will consume messages from the SAP NetWeaver JMS provider you can use the following name: jmsfactory/default/QueueConnectionFactory. To see all available connection factories in SAP NetWeaver you have to Open SAP NetWeaver AdministratorChoose Configuration Management -> Infrastructure -> JMS Server ConfigurationEnter “JMS Connection Factory” as a Type filter in the filters row and press enterThe table will show the available JMS Connection FactoriesJNDI Credential AlliasJndiCredentialAliasStringIn and outSpecifies the alias for the user name and password that will be used for the creation of the JNDI context. You can use the Credential Editor to manage the credential aliases.Queue Credential AliasQueueCredentialAliasStringIn and outSpecifies the alias to the identity that will be used to create a JMS queue connection. You can use the Credential Editor to manage the credential aliases.Read TimeoutReadTimeoutLong5000In and outSpecifies the time in milliseconds that determines how long will attempt to read a message. Queue NameQueueNameStringIn and outSpecifies the name of the queue to write to.MessageMessageStringOutSpecifies the message body.SuccessBooleanOutIndicates whether the action succeeded or failed. If it failed, errors are displayed in the server trace ic PublishYou use this action to send text-based messages to an existing topic on a Java Message Service (JMS) server.The following table lists properties for the JMS Topic Publish action:NamePropertyData TypeDefault valueAccessUseConnection AliasConnPropAliasStringIn and outIdentifies the JMS Connection alias that you want to use. This property is not mandatory – you can choose to use an alias or enter the connection details for the action manually. In case when you select an alias the URL, JNDI Context Provider and JNDI Factory Context are filled during the runtime automatically with the data from the alias. If you do not choose an alias than you should fill them with proper data. You can manage the JMS Connection aliases through System Connection Editor. URLJndiUrlStringIn and outSpecifies the URL for the JNDI service provider. You can find information how to construct the URL for connection to the SAP NetWeaver JNDI service provider in Creating an Initial Context -> Connection via the ICM and/or Connection via the Message Server. AS Java Ports provides a list of ports used by SAP NetWeaver.JNDI Context ProviderJndiContextProviderStringIn and outIdentifies the initial context factory to use. The value of the property should be the fully qualified class name of the factory class that will create an initial context.To connect to the SAP NetWeaver JNDI Registry Service, you have to use the following initial context factory class name: com.sap.engine.services.jndi.InitialContextFactoryImpl.JNDI Factory ContextJndiFactoryContextStringIn and outIdentifies the connection factory to use. Specifies the name that will be used for the lookup of the factory class that will create connections with a publish/subscribe JMS provider. In case you will publish messages to the SAP NetWeaver JMS provider you can use the following name: jmsfactory/default/TopicConnectionFactory. To see all available connection factories in SAP NetWeaver you have to Open SAP NetWeaver AdministratorChoose Configuration Management -> Infrastructure -> JMS Server ConfigurationEnter “JMS Connection Factory” as a Type filter in the filters row and press enterThe table will show the available JMS Connection FactoriesJNDI Credential AliasJndiCredentialAliasStringIn and outSpecifies the alias for the user name and password that will be used for the creation of the JNDI context. You can use the Credential Editor to manage the credential aliases.Queue Credential AliasQueueCredentialAliasStringIn and outSpecifies the alias to the identity that will be used to create a JMS queue connection. You can use the Credential Editor to manage the credential ic NameTopicNameStringIn and outSpecifies the topic name to which message will be published.Message ExpirationMessageExpirationLong5000In and outSpecifies the time in milliseconds, that determines how long will attempt to read a messageDelivery ModeDeliveryModeInt2In and outSpecify the delivery mode for the message. There are two available modes: Persistent (value = 1), where the message is persisted to the database until the send attempt is successful. This ensures that the message won’t be lost in case of JMS provider failure. Non Persistent (value = 2), message is not persisted and thus its delivery is not guarantee in case of a failure during the delivery attempts. The default delivery mode is Non Persistent.PriorityPriorityInt4In and outSpecifies the priority of the message. The level of priority range from 0 (low) to 9 (highest). The default priority level is 4.MessageMessageStringIn and outSpecifies the message body.SuccessBooleanOutIndicates whether the action succeeded or failed. If it failed, errors are displayed in the server trace log.ExamplesPreparation stepsCreate connection alias for the JMS Queue Write/Read examplesYou can create a connection alias instead of entering connection data for every JMS Action. To create such alias performs the following steps:Access the MII Administration MenuSelect component Data Service -> System Connection EditorChoose component type JMSCreate a new entry with the following parameters:Name: JMSQueueServer URL: localhost:50004JNDI Context Provider: com.sap.engine.services.jndi.InitialContextFactoryImplJNDI Factory Context: jmsfactory/default/QueueConnectionFactoryCreate connection alias for the JMS Topic exampleCreate this alias by follow the instructions from previous point and using these parameters:Name: JMSTopicServer URL: localhost:50004JNDI Context Provider: com.sap.engine.services.jndi.InitialContextFactoryImplJNDI Factory Context: jmsfactory/default/TopicConnectionFactory Create credential store alias.The steps to create credential alias are:Access the MII Administration MenuSelect component Security Services -> Credential EditorCreate a new entry with the following parameters:Name: JMSConnectionUser Name: <any valid user that has access to the queue>Password: <password that matches above user>Confirm Password: <password that matches above user>Create JMS QueueIn one of the examples you will send messages to and in the other you will consume messages from that queue. To create a JMS queue in NetWeaver perform the following steps:Access NetWeaver AdministratorSelect Configuration Management -> Infrastructure -> JMS Server ConfigurationCreate a new Queue with name MIITestQueueFind in the list, its name should be jmsqueues/default/MIITestQueueCreate JMS Topic Following the instructions from 4.1.4 create JMS Topic with name MIITestTopic. The full name of the topic after it is saved should be jmstopics/default/MIITestTopic.JMS Queue Write ExampleYou will create a transaction that sends messages to the JMS Queue that you’ve created during the preparation steps. The number of messages that will be sent will be controlled by a global property.Open the MII WorkbenchCreate new Transaction and name it JMSQueueWriteExampleOpen the transaction global properties and create new property of type int with name JMSExamplesMsgCount and set its default value to 10. Go to Transaction tab of JMSQueueExampleLocate Properties -> Global in the treeDouble click on Global and you will see a new window with all global propertiesClick on Add buttonEnter JMSExampleMsgCount as a name, select int as a type and enter 10 as default value.Click on OK buttonYou will see the new property in the listClick on OK buttonChange the name of the available sequence to LoopSequencеAdd “While Loop” action to LoopSequence and name it WhileLoopGo to Actions tabLocate Logic Action groupsDrag and drop While Loop to LoopSequence.Change the name to WhileLoopSet the maxIterations parameter of WhileLoop to the global parameter JMSExampleMsgCountRight click on WhileLoop actionSelect Links from the menu, Links editor will popupBrowse the tree on the left and locate Globals -> JMSExampleMsgCountBrowse the tree on the right and locate WhileLoop -> MaxIterationsDrag and drop JMSExampleMsgGount on to MaxIteations.This will set the maximum number of iterations to the global parameter.Create new Sequence and name it JMSWriteSequenceRight click on LoopSequenceSelect Add SequenceAdd JMS Queue Write action to JMSWriteSequence and name it JMSQueueWriteIn Actions tab locate JMS Action groupDrag and drop Queue Write action to JMSWriteSequenceConfigure the JMSQueueWrite action by using the created connection and credential aliases and the queue from the preparation steps.Right click on JMSQueueWrite and select Configure. You will see JMS Queue write Configuration windowSelect JMSQueue from the Connection Alias drop down. The URL, JNDI Context Provider and JNDI Factory Context field will be filled with the data from the alias.Select the credential alias that you’ve created during the preparation stepsEnter the name of the queue that you’ve created during the preparation steps, i.e. jmsqueues/default/MIITestQueueEnter message expiration duration. As the default value 5000(=5sec) is too small for the example please change it to 600000 (10 min).Customize the JMS message in a way you want, for example lets construct the message by using the current time, current loop iteration and some text.Right click on JMSQueueWrite and select Links, you’ll see link editor windowClick on Show Expression Editor.From the tree on the right locate JMSQueueWrite -> Message and click on it, as result targetXPath will be filled with JMSQueueWrite.MessageFill the Expression text field with the following: datenow & " MII JMSQueueWriteExample message " & WhileLoop.CurrentItemClick Add button and close Link editor windowCreate new sequence and name it TracerSequenceRight click on JMSWriteSequenceSelect Add SequenceAdd Tracer action to TracerSequence and name it TracerLink JMSQueueWrite->Message to the Tracer->MessageRight click on Tracer, select LinksFrom the left tree drag JMSQueueWrite->Message and drop it on the Tracer-Message from the right tree.Close link editor.Save the transaction and execute it. You’ll see messages in the tracesJMS Queue Read ExampleYou will create a transaction that will consume messages send by the previous example – JMS Queue Write Example.Create new Transaction and name it JMSQueueReadExampleChange the name of the available sequence to LoopSequencеAdd “While Loop” action to LoopSequence and name it WhileLoopGo to Actions tabLocate Logic Action groupsDrag and drop While Loop to LoopSequence.Change the name to WhileLoopSet the maxIterations parameter of WhileLoop to the global parameter JMSExampleMsgCountRight click on WhileLoop actionSelect Links from the menu, Links editor will popupBrowse the tree on the left and locate Globals -> JMSExampleMsgCountBrowse the tree on the right and locate WhileLoop -> MaxIterationsDrad JMSExampleMsgGount and drop it on MaxIteations.This will set the maximum number of iterations to the global parameter.Create new Sequence and name it JMSReadSequenceRight click on LoopSequenceSelect Add SequenceAdd JMS Queue Read action to JMSReadSequence and name it JMSQueueReadIn Actions tab locate JMS Action groupDrag and drop Queue Read action to JMSreadSequenceConfigure the JMSQueueRead action by using the created connection and credential aliases and the queue from the preparation steps.Right click on JMSQueueRead and select Configure. You will see JMS Queue Read Configuration windowSelect JMSQueue from the Connection Alias drop down. The URL, JNDI Context Provider and JNDI Factory Context filled will be filled with the data from the alias.Select the credential alias that you’ve created during the preparation stepsEnter the name of the queue that you’ve created during the preparation steps, i.e. jmsqueues/default/MIITestQueue.Create new sequence and name it TracerSequenceRight click on JMSReadSequenceSelect Add SequenceAdd Tracer action to TracerSequence and name it TracerLink JMSQueueRead->Message to the Tracer->Message in order to trace what messages are receivedRight click on Tracer, select LinksFrom the left tree drag JMSQueueRead->Message and drop it on the Tracer -> Message from the right tree.Close link editor.Save the transaction and execute it. Most probably you won’t see any messages because the messages that were sent with the previous example have been expired.Run previous example (JMS Queue Write Example)Run again this example, now you will see that messages are consumed by the example. Please keep in mind that messages have expiration time, after that they are destroyed and cannot be consumed.JMS Topic ExampleYou will create a transaction that publishes messages to the JMS Topic that you’ve created during the preparation steps. The number of messages that will be sent will be controlled by a global property.Open the MII WorkbenchCreate new Transaction and name it JMSTopicExampleChange the name of the available sequence to LoopSequencеAdd “While Loop” action to LoopSequence and name it WhileLoopGo to Actions tabLocate Logic Action groupsDrag and drop While Loop to LoopSequence.Change the name to WhileLoopSet the maxIterations parameter of WhileLoop to the global parameter JMSExampleMsgCountRight click on WhileLoop actionSelect Links from the menu, Links editor will popupBrowse the tree on the left and locate Globals -> JMSExampleMsgCountBrowse the tree on the right and locate WhileLoop -> MaxIterationsDrag and drop JMSExampleMsgGount to MaxIteations.This will set the maximum number of iterations to the global parameter.Create new Sequence and name it JMSTopicSequenceRight click on LoopSequenceSelect Add SequenceAdd JMS Topic Publish action to JMSTopicSequence and name it JMSTopicPublishIn Actions tab locate JMS Action groupDrag and drop Topic Publish action to JMSTopicSequenceConfigure the JMSTopicPublish action by using the created connection and credential aliases and the queue from the preparation steps.Right click on JMSTopicPublish and select Configure. You will see JMS Queue write Configuration windowSelect JMSTopic from the Connection Alias drop down. The URL, JNDI Context Provider and JNDI Factory Context field will be filled with the data from the alias.Select the credential alias that you’ve created during the preparation stepsEnter the name of the queue that you’ve created during the preparation steps, i.e. jmsqueues/default/MIITestTopicCustomize the JMS message in a way you want, for example lets construct the message by using the current time, current loop iteration and some text.Right click on JMSTopicPublish and select Links, you’ll see link editor windowClick on Show Expression Editor.From the tree on the right locate JMSTopicPublish -> Message and click on it, as result targetXPath will be filled with JMSTopicPublish.MessageFill the Expression text field with the following: datenow & " MII JMS Topic Example message " & WhileLoop.CurrentItemClick Add button and close Link editor windowCreate new sequence and name it TracerSequenceRight click on JMSTopicSequenceSelect Add SequenceAdd Tracer action to TracerSequence and name it TracerLink JMSTopicPublishWrite->Message to the Tracer->MessageRight click on Tracer, select LinksFrom the left tree drag JMSTopicPublish->Message and drop it on the Tracer -> Message from the right tree.Close link editor.Save the transaction and execute it. You’ll see messages in the tracesExported examples: ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download