Announcement

Collapse
No announcement yet.

SMB with Azure File Storage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SMB with Azure File Storage

    Has any one tried accessing Azure file storage using smb File reader?

    More details about Azure file storage here.https://azure.microsoft.com/en-in/do...-to-use-files/

    Since I could not make it work using native SMB file reader. I used libraries provided by microsoft(see the java tab in above link for more details, will share mirth transformer code shortly); though would like the native thing to work

  • #2
    If you want to work with an Azure storage system, there is a java library from azure with the name of microsoft-windowsazure-api-0.4.6.

    The installation is easy, You need to upload/add it inside your mirth/custom-lib/lib folder and then restart.

    And then, you can try setting up the smb file reader as you want.
    HL7v2.7 Certified Control Specialist!

    Comment


    • #3
      Using the library from MS...but not sure how to use smb reader

      I am already using the library as an alternative

      However I think the smb reader won't be able to use them. Would they?
      Out of box smb reader - I could not make it work with the azure storage..

      Here's the current code I am using...

      Code:
      // get the jar files from github and include them as dependencies
      importPackage(com.microsoft.azure.storage.*);
      importPackage(com.microsoft.azure.storage.file.*);
      // Configure the connection-string with your values
      SERVER_NAME = "resource111111";
      ACCOUNT_KEY = "verylonggibberishstring";
      SHARE_NAME = "rootshare";//rootdirectory on your server
      
      storageConnectionString =
          "DefaultEndpointsProtocol=http;" +
          "AccountName="+SERVER_NAME+";" +
          "AccountKey="+ACCOUNT_KEY;
      s1 = new com.microsoft.azure.storage.StorageCredentialsAccountAndKey(SERVER_NAME,ACCOUNT_KEY);
      // Use the CloudStorageAccount object to connect to your storage account
      try {
          storageAccount = new com.microsoft.azure.storage.CloudStorageAccount(s1);
      } catch (invalidKey) {
          // Handle the exception
          logger.info(invalidKey)
      }
      // Create the file storage client.
      fileClient = storageAccount.createCloudFileClient();
      // Get a reference to the file share
      share = fileClient.getShareReference(SHARE_NAME);
      //Get a reference to the root directory for the share.
      rootDir = share.getRootDirectoryReference();
      
      transfer = function(inpath,outpath){
      	mydir = rootDir.getDirectoryReference(inpath);
      	list1 = mydir.listFilesAndDirectories();
      	itr=list1.iterator();
      	while(itr.hasNext()){
      		cloudfile=itr.next();
      		try { 
      		    cloudfile.downloadToFile(outpath+cloudfile.getName());
      		    cloudfile.deleteIfExists();
      		} catch (e) {
      		    
      		}
      	}
      }
      
      inpath="sourcefolder/subfolder"; //give the folder name on azure
      outpath="C:/Localfolder/"; // local folder. add extra / at end
      
      transfer(inpath,outpath)

      Comment


      • #4
        Did you try creating File Reader with smb as a method? I think it should work after you upload that library.
        HL7v2.7 Certified Control Specialist!

        Comment


        • #5
          Tried your suggestion... but no conenction...

          How will the smb reader know to use MS libraries?

          Comment


          • #6
            Does the Microsoft-specific library do anything special on top of the SMB protocol? If so, then it makes sense that the standard File Reader doesn't work.
            Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

            Nicholas Rupley
            Work: 949-237-6069
            Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


            - How do I foo?
            - You just bar.

            Comment

            Working...
            X