/**
  *
  * <!-- begin-custom-doc -->
  * <!-- end-custom-doc -->
  *
  * @generated This method is called when an activity is destroyed. It is called by the
  *     BusinessWorks Engine and the method must be implemented to release or cleanup any resources
  *     held by this activity.
  */
 @Override
 public void destroy() {
   if (this.getActivityLogger().isDebugEnabled()) {
     activityLogger.debug(
         RuntimeMessageBundle.DEBUG_PLUGIN_ACTIVITY_METHOD_CALLED,
         new Object[] {
           "destroy()",
           activityContext.getActivityName(),
           activityContext.getProcessName(),
           activityContext.getDeploymentUnitName(),
           activityContext.getDeploymentUnitVersion()
         });
   }
   // begin-custom-code
   // add your own business code here
   try {
     channel.close();
     connection.close();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (TimeoutException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   // end-custom-code
   super.destroy();
 }
 /**
  *
  * <!-- begin-custom-doc -->
  * <!-- end-custom-doc -->
  *
  * @generated This method is called to initialize the activity. It is called by the BusinessWorks
  *     Engine once for a particular activity lifetime.
  * @throws ActivityLifecycleFault Thrown if the activity initialization is unsuccessful or
  *     encounters an error.
  */
 @Override
 public void init() throws ActivityLifecycleFault {
   if (this.getActivityLogger().isDebugEnabled()) {
     activityLogger.debug(
         RuntimeMessageBundle.DEBUG_PLUGIN_ACTIVITY_METHOD_CALLED,
         new Object[] {
           "init()",
           activityContext.getActivityName(),
           activityContext.getProcessName(),
           activityContext.getDeploymentUnitName(),
           activityContext.getDeploymentUnitVersion()
         });
   }
   // begin-custom-code
   ConnectionFactory factory = new ConnectionFactory();
   factory.setHost(activityConfig.getHost());
   try {
     factory.setPort(Integer.parseInt(activityConfig.getPort()));
   } catch (NumberFormatException ex) {
     factory.setPort(5672);
   }
   try {
     connection = factory.newConnection();
     channel = connection.createChannel();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (TimeoutException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   // end-custom-code
   super.init();
 }