Skip Ribbon Commands
Skip to main content
Navigate Up
Sign In

Quick Launch

Average Rating:

facebook Twitter
Email
Print Bookmark Alert me when this article is updated

Feedback

Quick Start: Building .NET UM sample application on Linux
Content
UM version 6.12.1 introduced the Ultra Messaging .NET API to the Linux 64-bit platform.

The following is a reference example of steps taken to build the lbmsrc.cs sample application on Linux:

Example

Pre-requisite:

1. Install the 64-bit documentation and executable on a linux platform. You will find the lbmcs.dll in the bin/dotnet directory:
# cd /tmp
# sh UMS_6.12.1_Linux-glibc-2.17-x86_64.sh
# unzip UM_6.12_doc.zip
# find UMS_6.12.1 -name lbmcs.dll​


2. Create a new directory for your application and copy over lbmsrc.cs and dependencies:
# mkdir APP_DIR
# cp /tmp/UM_6.12/doc/dotnet_example/VerifiableMessage.cs /tmp/APP_DIR/.
# cp /tmp/UM_6.12/doc/dotnet_example/lbmExampleUtil.cs /tmp/APP_DIR/.
# cp /tmp/UM_6.12/doc/dotnet_example/lbmsrc.cs /tmp/APP_DIR/.


3. Create a default console application project:
# cd /tmp/APP_DIR/.
# dotnet new console

  This should create new files in the directory:

# find
.
./VerifiableMessage.cs
./lbmExampleUtil.cs
./lbmsrc.cs
./APP_DIR.csproj
./Program.cs
./obj
./obj/APP_DIR.csproj.nuget.dgspec.json
./obj/APP_DIR.csproj.nuget.g.props
./obj/APP_DIR.csproj.nuget.g.targets
./obj/project.assets.json
./obj/APP_DIR.csproj.nuget.cache


# cat ./APP_DIR.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

</Project>

4. Modify the .csproj file to include appropriate references to the relevant source files and libraries 

# cat APP_DIR.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <PlatformTarget>anycpu</PlatformTarget>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="lbmcs">
            <HintPath>/tmp/UMS_6.12.1/Linux-glibc-2.17-x86_64/bin/dotnet/lbmcs.dll</HintPath>
    </Reference>
    <Reference Include="lbmcssdm">
            <HintPath>/tmp/UMS_6.12.1/Linux-glibc-2.17-x86_64/bin/dotnet/lbmcssdm.dll</HintPath>
    </Reference>
  </ItemGroup>

 <ItemGroup>
    <Compile Include="lbmExampleUtil.cs">
      <Link>lbmExampleUtil.cs</Link>
    </Compile>
    <Compile Include="lbmsrc.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="VerifiableMessage.cs" />
  </ItemGroup>

</Project>


5. Build the project:

# dotnet build

Microsoft (R) Build Engine version 16.2.32702+c4012a063 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 53.13 ms for /tmp/APP_DIR/APP_DIR.csproj.
  APP_DIR -> /tmp/APP_DIR/bin/Debug/netcoreapp2.2/APP_DIR.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.32


6. Run the application:

  Update your $PATH, $LD_LIBRARY_PATH and LICENCE as needed:

# export PATH=$PATH:/tmp/UMS_6.12.1/Linux-glibc-2.17-x86_64/bin/
# export LD_LIBRARY_PATH=/lib64:/tmp/UMS_6.12.1/Linux-glibc-2.17-x86_64/lib
# export LBM_LICENSE_FILENAME=/tmp/lic.txt


  Run the application:

# dotnet  /tmp/APP_DIR/bin/Debug/netcoreapp2.2/APP_DIR.dll -P 1000 -R M1g/1m mytopic

12/5/19 2:35:49 PM [Warning]: Core-9401-4: WARNING: default_interface for a context should be set to a valid network interface.

Will start sending in 1 second...

Sending 10000000 messages of size 25 bytes to topic [mytopic]



More Information
These exceptions may occur at run-time if the $LD_LIBRARY_PATH does not point to the UM install "/lib" directory:

Unhandled Exception: System.DllNotFoundException: Unable to load shared library 'Kernel32.dll' or one of its dependencies ...
Unhandled Exception: System.TypeInitializationException: The type initializer for 'com.latencybusters.lbm.LBM' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'lbm' or one of its dependencies.




Reference


Attachments


Applies To
Product: Ultra Messaging
Problem Type: Installation
User Type: Developer
Project Phase: Implement
Product Version:
Database:
Operating System:
Other Software:

Last Modified Date: 12/10/2019 12:19 AM ID: 609755
People who viewed this also viewed

Feedback

Did this KB document help you?



What can we do to improve this information (2000 or fewer characters)