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 » WebSphere Message Broker (ACE) Support » Broker Bar File Backup Creation

Post new topic  Reply to topic
 Broker Bar File Backup Creation « View previous topic :: View next topic » 
Author Message
tlowry
PostPosted: Mon Mar 06, 2006 7:37 am    Post subject: Broker Bar File Backup Creation Reply with quote

Newbie

Joined: 22 May 2001
Posts: 3
Location: Mutual of Omaha

I am trying to figure out how to create a scripted process to rebuild a Version 5 or Version 6 message broker in the event of a failure or need to replicate the broker on a different host. Our environment is setup where the development of message flows is performed in a distributed envrionment and developers submit bar files to a centralized area when an update to the production envrionment is required. These bar files typically only contain what has been changed for an application and does not contain all of the message flows and message sets that have been deployed to an execution group. What I would like to be able to do is to create a bar file periodically from the message broker that would be a backup image of what has been deployed to a broker execution group. This bar file could then be used to replicate the execution group on a different broker in the event of a disaster or if additional capacity would be needed. Has anyone been able to build a bar file in this manner or have any ideas on what might work?
Back to top
View user's profile Send private message
mqmatt
PostPosted: Mon Mar 06, 2006 7:43 am    Post subject: Reply with quote

Grand Master

Joined: 04 Aug 2004
Posts: 1213
Location: Hursley, UK

Hi,
The creating a BAR file could be done by either the mqsicreatebar utility or (as they are zip-based files) programatically, for example the java.util.zip package in Java.
On V6 you might like to look at the latter approach in conjunction with the Configuration Manager Proxy API, which can be use to drive the creation, deployment and monitoring of your domain artefacts.

Regards
-Matt
Back to top
View user's profile Send private message
tlowry
PostPosted: Mon Mar 06, 2006 7:50 am    Post subject: What if you don't have access to the flows? Reply with quote

Newbie

Joined: 22 May 2001
Posts: 3
Location: Mutual of Omaha

Matt

Thanks for the response, but what if you don't have access to the source? The developers store all of the message flows and message sets that they work on in thier own CVS libraries and build the bar files in thier own workspace. In order to use the mqsicreatebar command, I would need a workspace created that would contain all of the flows and sets from many different CVS libraries and would need to be kept current with changes. Since each of these libraries are protected for an application, this could get rather complicated. It doesn't appear that the mqsicreatebar command can access CVS libraries to retrieve the source which would be ideal in that I could set this up once and have it retrieve the current version whenever I run the script. Does this make any sense?
Back to top
View user's profile Send private message
mqmatt
PostPosted: Mon Mar 06, 2006 8:39 am    Post subject: Reply with quote

Grand Master

Joined: 04 Aug 2004
Posts: 1213
Location: Hursley, UK

Hi,
If you don't have access to the message flow source, then the problem is a lot simpler - BAR file packaging and deployment becomes a task of simply creating and mantaining zip files - so long as you have the compiled code available.

Use the java.util.zip package to create a new zip file, then add the cmf files (and any related deployment descriptor, dictionaries etc.) to it. Then use the CMP API to deploy what you've created.
You don't even need to persist the BAR file to disk, if you use the InputStream parameter to the ExecutionGroup.deploy() method. (Actually, that's what the v5 Rapid Application Deployment feature did.)

Cheers
-Matt
Back to top
View user's profile Send private message
mqmatt
PostPosted: Mon Mar 06, 2006 9:37 am    Post subject: Reply with quote

Grand Master

Joined: 04 Aug 2004
Posts: 1213
Location: Hursley, UK

I've just put together a short example that does what I suggested -
apologies for the lack of comments, although should be pretty self-explanatory.
Code:

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import com.ibm.broker.config.proxy.BrokerProxy;
import com.ibm.broker.config.proxy.ConfigManagerConnectionParameters;
import com.ibm.broker.config.proxy.ConfigManagerProxy;
import com.ibm.broker.config.proxy.ConfigManagerProxyException;
import com.ibm.broker.config.proxy.DeployResult;
import com.ibm.broker.config.proxy.ExecutionGroupProxy;
import com.ibm.broker.config.proxy.MQConfigManagerConnectionParameters;
import com.ibm.broker.config.proxy.TopologyProxy;

public class TestDeploy {

   /**
     * Generates the data of a BAR file that contains the
     * information required by the Configuration Manager to
     * deploy a set of objects from the execution group.
     * @param filesToBeAddedToBAR containing the file names
     * that require deployment.
     * @return InputStream Containing the BAR file required to deploy objects
     */
    private static InputStream generateBARFile(String[] filesToBeAddedToBAR)
    throws IOException {
        byte[] buffer = new byte[2000];
        PipedInputStream retVal = new PipedInputStream();
       PipedOutputStream pos = new PipedOutputStream(retVal);
        ZipOutputStream zos = new ZipOutputStream(pos);

        for (int i=0; i<filesToBeAddedToBAR.length; i++) {
            String name = filesToBeAddedToBAR[i];           
            FileInputStream in = new FileInputStream(name);

            zos.putNextEntry(new ZipEntry(name));
            int j;
            while ((j = in.read(buffer)) > 0) {
                zos.write(buffer, 0, j);
            }
            zos.closeEntry();
            in.close();
        }
       
        zos.close();
        return retVal;
    }
   
   
    /**
     * Deploys files 'file1.cmf' and 'file2.cmf'
     * to the default execution group.
     * @param args not used
     */
    public static void main(String[] args) {
       
       // Set up the parameters
       String CM_HOSTNAME = "localhost";
       int CM_PORT = 2414;
       String CM_QMGR = "WBRK6_DEFAULT_QUEUE_MANAGER";
       String BROKER_NAME = "WBRK6_DEFAULT_BROKER";
       String EG_NAME = "default";
       String[] filesToDeploy = { "flow1.cmf", "flow2.cmf" };
       String BAR_FILE_NAME = "TestDeploy generated BAR";
       long deployTimeoutMs = 60000;
              
       // Connect to the CM
       ConfigManagerConnectionParameters cmcp =
           new MQConfigManagerConnectionParameters(CM_HOSTNAME, CM_PORT, CM_QMGR);
       ConfigManagerProxy cmp;
      try {
         cmp = ConfigManagerProxy.getInstance(cmcp);
          TopologyProxy t = cmp.getTopology();
          BrokerProxy b = t.getBrokerByName(BROKER_NAME);
          ExecutionGroupProxy e = b.getExecutionGroupByName(EG_NAME);
          
          // Generate the BAR file and do the deployment
          DeployResult dr = e.deploy(generateBARFile(filesToDeploy), BAR_FILE_NAME, true, deployTimeoutMs);
          System.out.println("Deployment completion code = "+dr.getCompletionCode());
          
      } catch (ConfigManagerProxyException e1) {
         e1.printStackTrace();
      } catch (IOException e2) {
         e2.printStackTrace();
      }
    }
}

Let me know if it does the job, or if you'd like anything explaining
-Matt
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Mar 06, 2006 4:00 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Matt -
Correct me if I'm wrong, but there's still no way to extract .cmf files from a broker, right? That is, there's no equivalent of the MS03 saveqmgr support pack, and no easy way to create one?

One has to maintain an ongoing history of deployed bar files and cmf files.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mqmatt
PostPosted: Tue Mar 07, 2006 3:06 am    Post subject: Reply with quote

Grand Master

Joined: 04 Aug 2004
Posts: 1213
Location: Hursley, UK

Yes, that's correct Jeff; there's no easy way of extracting the CMF files from the broker directly.
(Although it is possible to get back any XSL and JARs you've deployed, because they're stored directly on the broker's file system.)

Cheers
-Matt
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Broker Bar File Backup Creation
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.