Date   

Re: Wombat Queue Destroy

Sam Wilson <Sam.Wilson@...>
 

Hey Damian,

I'm just getting around to looking at this now. Would you prefer a patch that adds wombatQueue_deallocate, or one that merges both wombatQueue_allocate and wombatQueue_create into wombatQueue_allocate and makes wombatQueue_create a dummy function?

The advantage of the first option is that the API works more like it was intended, but it will break any current users of wombat queues.

The second option retains backward compatibility, but you end up losing the benefits of having separate allocate/create functions.

Thanks,
Sam

On 14-09-03 05:34 AM, Damian Maguire wrote:
Hey Sam,

Unfortunately this is a weakness in the API for the Wombat Queue implementation - it really should have a wombatQueue_deallocate, but it isn't presently available. If you'd like to raise an issue in bugzilla (bugs.openmama.org) we can look at getting it added. Better yet, we'd be happy to accept a patch which addresses the issue in the queue.

Thanks, 

Damian


On Tue, Sep 2, 2014 at 7:20 PM, Sam Wilson <Sam.Wilson@...> wrote:
Hello!

I'm trying to use Wombat Queue, but I can't figure out how to safely
free a queue when the creation fails. Here's my example:

     wombatQueue queue;
     wombatQueueStatus status = wombatQueue_allocate(&queue);
     if (WOMBAT_QUEUE_OK != status) {
         return; // log the error state or what have you
     }

     status = wombatQueue_create(queue, MAX_SIZE, INITIAL_SIZE,
                                 CHUNK_SIZE);
     if (WOMBAT_QUEUE_OK != status) {
         wombatQueue_destroy(queue); // Doesn't work because the
                                     // queue hasn't been created.

         // So how do I free the memory allocated by
         // wombatQueue_allocate?
     }

Thanks for your help,
Sam
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev



Re: VectorChar and VectorBool field type enumerator

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Hi Damian,

 

I have raised Bugzilla ticket 168 (http://bugs.openmama.org/show_bug.cgi?id=168) and provided a patch to address this for C/C++ for the first stage.

 

Thanks.

 

--Alireza

 

From: Damian Maguire [mailto:damian@...]
Sent: Friday, September 19, 2014 11:32 AM
To: Alireza Assadzadeh
Cc: openmama-dev@...
Subject: Re: [Openmama-dev] VectorChar and VectorBool field type enumerator

 

Hey Alireza,

 

Thanks for sending this through, and sorry about the delayed response. In this case, I agree that these values should be added to the mamaFieldType enum, and their implementations should be completed across all the languages. 

 

At this stage you've really got two options - either raise a Bugzilla ticket and we'll see about getting it added when we have a chance, or submit a patch yourself which addresses the problems. For the patching option, that can be approached in stages easily enough - beginning with the enum updates (and associated mamaFieldTypeToString and stringToMamaFieldType changes, along with anything else which may misbehave given the new values), then filling in each of the language gaps in further commits.

 

Obviously we're happy to assist if you go down the route of patching yourself, just drop us a mail and we'll lend a hand.

 

Cheers, 

 

Damian

 

On Fri, Sep 5, 2014 at 8:35 PM, Alireza Assadzadeh <Alireza.Assadzadeh@...> wrote:

Hi folks,

 

I noticed that VectorChar and VectorBool do not have  a field type enumerator  in Mama (i.e. mamaFieldType enum in mama/fielddesc.h). Also, the related code for VectorChar and VectorBool in C/ C++, C#, JNI does not have the type related implementations for these vector types as compared to other vector types, such as VectorU32 (enumerator: MAMA_FIELD_TYPE_VECTOR_U32).

 

I imagine these types may not be widely and there are alternatives field types for them(e.g. Opaque, String and unsinged integer).

 

Should VectorChar and VectorBool  types be included in the mamaFieldType enum? For example with the numbers shown below:

 

<code>

diff --git a/mama/c_cpp/src/c/mama/fielddesc.h b/mama/c_cpp/src/c/mama/fielddesc.h

index e3af6e1..a374489 100644

--- a/mama/c_cpp/src/c/mama/fielddesc.h

+++ b/mama/c_cpp/src/c/mama/fielddesc.h

@@ -90,6 +90,8 @@ typedef enum mamaFieldType_

     MAMA_FIELD_TYPE_PRICE         =   27,

 

     /** Array type support */

+    MAMA_FIELD_TYPE_VECTOR_BOOL   =   29,

+    MAMA_FIELD_TYPE_VECTOR_CHAR   =   30,

     MAMA_FIELD_TYPE_VECTOR_I8     =   34,

     MAMA_FIELD_TYPE_VECTOR_U8     =   35,

     MAMA_FIELD_TYPE_VECTOR_I16    =   36,

</code>

 

And then also have the corresponding type related changes in the rest of Mama codebase?

 

Regards,.

 

--Alireza


_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev

 


[PATCH 2.3.1 5/5] MAMA: Update examples and test tools for completed support of Vector Bool and Vectar Char.

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Signed-off-by: Alireza Assadzadeh <Alireza.Assadzadeh@...>
---
mama/c_cpp/src/examples/c/mamalistencachedc.c | 26 ++++++++++++++
.../c_cpp/src/examples/cpp/mamalistencachedcpp.cpp | 40 ++++++++++++++++++++++
mama/c_cpp/src/examples/cpp/mamalistencpp.cpp | 16 +++++++++
.../src/testtools/capturereplay/c/captureconvert.c | 10 ++++++
4 files changed, 92 insertions(+)

diff --git a/mama/c_cpp/src/examples/c/mamalistencachedc.c b/mama/c_cpp/src/examples/c/mamalistencachedc.c
index db6d3ee..6d8ccf4 100644
--- a/mama/c_cpp/src/examples/c/mamalistencachedc.c
+++ b/mama/c_cpp/src/examples/c/mamalistencachedc.c
@@ -2630,6 +2630,32 @@ void printField(mamaFieldCacheField field)
printf ("%s\n", priceString);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* result = NULL;
+ mama_size_t size = 0;
+ mama_size_t i =0;
+ mamaFieldCacheField_getBoolVector(field,&result,&size);
+ printf("\n");
+ for (i=0;i<size;i++)
+ {
+ printf(" %d\n", (int)result[i]);
+ }
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* result = NULL;
+ mama_size_t size = 0;
+ mama_size_t i =0;
+ mamaFieldCacheField_getCharVector(field,&result,&size);
+ printf("\n");
+ for (i=0;i<size;i++)
+ {
+ printf(" %c\n", (int)result[i]);
+ }
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const mama_i8_t* result = NULL;
diff --git a/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp b/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp
index 23e94b8..e2c3f45 100644
--- a/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp
+++ b/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp
@@ -1287,6 +1287,22 @@ void DisplayCallback::displayMsgField (const MamaMsg& msg,
printData ("%s\n", price);
}
break;
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* vectorBool;
+ size_t resultLen;
+ field.getVectorBool (vectorBool, resultLen);
+ displayVectorField (vectorBool, resultLen, "%d");
+ }
+ break;
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* vectorChar;
+ size_t resultLen;
+ field.getVectorChar (vectorChar, resultLen);
+ displayVectorField (vectorChar, resultLen, "%c");
+ }
+ break;
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const int8_t* vectorI8;
@@ -2149,6 +2165,30 @@ std::ostream& operator<<(std::ostream& os, const MamaFieldCacheField& field)
os << cachedPriceField.get(field).getAsString();
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ MamaFieldCacheFieldBoolVector cachedVectorField;
+ const mama_bool_t* values = NULL;
+ mama_size_t size = 0;
+ cachedVectorField.get(field,values,size);
+ for (mama_size_t i = 0; i < size; ++i)
+ {
+ os << "[" << (values[i] ? 1 : 0) << "]";
+ }
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ MamaFieldCacheFieldCharVector cachedVectorField;
+ const char* values = NULL;
+ mama_size_t size = 0;
+ cachedVectorField.get(field,values,size);
+ for (mama_size_t i = 0; i < size; ++i)
+ {
+ os << "[" << (char)values[i] << "]";
+ }
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
MamaFieldCacheFieldI8Vector cachedVectorField;
diff --git a/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp b/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp
index 082d00a..ed81b9d 100644
--- a/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp
+++ b/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp
@@ -1226,6 +1226,22 @@ void DisplayCallback::displayMsgField (const MamaMsg& msg,
printData ("%s\n", price);
}
break;
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* vectorBool;
+ size_t resultLen;
+ field.getVectorBool (vectorBool, resultLen);
+ displayVectorField (vectorBool, resultLen, "%d");
+ }
+ break;
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* vectorChar;
+ size_t resultLen;
+ field.getVectorChar (vectorChar, resultLen);
+ displayVectorField (vectorChar, resultLen, "%c");
+ }
+ break;
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const int8_t* vectorI8;
diff --git a/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c b/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c
index 4181219..b913a0c 100644
--- a/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c
+++ b/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c
@@ -538,6 +538,16 @@ static void copyMamaMsg (mamaMsg sourceMessage,
mamaMsg_destroy (internalTarget);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ MAMA_VECTOR_FIELD_COPY (Bool, mama_bool_t);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ MAMA_VECTOR_FIELD_COPY (Char, char);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
MAMA_VECTOR_FIELD_COPY (I8, mama_i8_t);
--
1.9.3


[PATCH 2.3.1 4/5] MAMA: Update gunittest for completed support of Vector Bool and Vectar Char.

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Signed-off-by: Alireza Assadzadeh <Alireza.Assadzadeh@...>
---
.../gunittest/c/fieldcache/fieldcachefieldtest.cpp | 60 ++++++++++++++++
.../gunittest/c/mamamsg/msgfieldvectortests.cpp | 29 +++++---
.../src/gunittest/c/mamamsg/msgvectortests.cpp | 2 +-
.../src/gunittest/c/payload/fieldvectortests.cpp | 9 ++-
.../fieldcache/MamaFieldCacheFieldTypesTest.cpp | 80 ++++++++++++++++++++++
5 files changed, 168 insertions(+), 12 deletions(-)

diff --git a/mama/c_cpp/src/gunittest/c/fieldcache/fieldcachefieldtest.cpp b/mama/c_cpp/src/gunittest/c/fieldcache/fieldcachefieldtest.cpp
index 124c5b6..0b65f2b 100644
--- a/mama/c_cpp/src/gunittest/c/fieldcache/fieldcachefieldtest.cpp
+++ b/mama/c_cpp/src/gunittest/c/fieldcache/fieldcachefieldtest.cpp
@@ -662,6 +662,66 @@ TEST_F(MamaFieldCacheFieldTestC, testSetGetI8Vector)
DESTROY_FIELD
}

+TEST_F(MamaFieldCacheFieldTestC, testSetGetBoolVector)
+{
+ //TODO: AA: Change u8 test
+ const mama_u8_t* retValue = NULL;
+ mama_size_t retSize;
+ mama_u8_t dataVector[3] = { 1, 2, 3 };
+
+ CREATE_FIELD(1, MAMA_FIELD_TYPE_VECTOR_U8)
+
+ // Adding only 2 fields
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_setU8Vector(field, dataVector, 2));
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_getU8Vector(field, &retValue, &retSize));
+ ASSERT_EQ(2, retSize);
+ ASSERT_TRUE(retValue);
+ ASSERT_EQ(1, retValue[0]);
+ ASSERT_EQ(2, retValue[1]);
+
+ dataVector[0] = 10;
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_setU8Vector(field, dataVector, 3));
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_getU8Vector(field, &retValue, &retSize));
+
+ ASSERT_EQ(3, retSize);
+ ASSERT_TRUE(retValue);
+ ASSERT_EQ(10, retValue[0]);
+ ASSERT_EQ(2, retValue[1]);
+ ASSERT_EQ(3, retValue[2]);
+
+ DESTROY_FIELD
+}
+
+TEST_F(MamaFieldCacheFieldTestC, testSetGetCharVector)
+{
+ //TODO: AA: Change u8 test
+ const mama_u8_t* retValue = NULL;
+ mama_size_t retSize;
+ mama_u8_t dataVector[3] = { 1, 2, 3 };
+
+ CREATE_FIELD(1, MAMA_FIELD_TYPE_VECTOR_U8)
+
+ // Adding only 2 fields
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_setU8Vector(field, dataVector, 2));
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_getU8Vector(field, &retValue, &retSize));
+ ASSERT_EQ(2, retSize);
+ ASSERT_TRUE(retValue);
+ ASSERT_EQ(1, retValue[0]);
+ ASSERT_EQ(2, retValue[1]);
+
+ dataVector[0] = 10;
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_setU8Vector(field, dataVector, 3));
+ ASSERT_EQ(MAMA_STATUS_OK, mamaFieldCacheField_getU8Vector(field, &retValue, &retSize));
+
+ ASSERT_EQ(3, retSize);
+ ASSERT_TRUE(retValue);
+ ASSERT_EQ(10, retValue[0]);
+ ASSERT_EQ(2, retValue[1]);
+ ASSERT_EQ(3, retValue[2]);
+
+ DESTROY_FIELD
+}
+
TEST_F(MamaFieldCacheFieldTestC, testSetGetU8Vector)
{
const mama_u8_t* retValue = NULL;
diff --git a/mama/c_cpp/src/gunittest/c/mamamsg/msgfieldvectortests.cpp b/mama/c_cpp/src/gunittest/c/mamamsg/msgfieldvectortests.cpp
index 7d690e1..874bcd9 100644
--- a/mama/c_cpp/src/gunittest/c/mamamsg/msgfieldvectortests.cpp
+++ b/mama/c_cpp/src/gunittest/c/mamamsg/msgfieldvectortests.cpp
@@ -78,14 +78,16 @@ protected:
MsgFieldVectorBoolTests()
: mOut(NULL)
{
- mIn[0] = 1;
- mIn[1] = 2;
+ mIn[0] = 0;
+ mIn[1] = 1;
}

virtual void SetUp()
{
MsgFieldVectorTestsC::SetUp();

+ mamaMsg_addVectorBool (mMsg, NULL, 1, mIn, VECTOR_SIZE);
+
mOut = NULL;
}

@@ -100,21 +102,32 @@ protected:
* ****************************************************************************
*/

-TEST_F(MsgFieldVectorBoolTests, DISABLED_GetVectorBool)
+TEST_F(MsgFieldVectorBoolTests, GetVectorBool)
{
- /* getVectorBool is declared in msgfield.h but not defined */
+ mStatus = mamaMsg_getField (mMsg, NULL, 1, &mField);
+ ASSERT_EQ (mStatus, MAMA_STATUS_OK) << "Failed getting field";
+ mStatus = mamaMsgField_getVectorBool (mField, &mOut, &mSize);
+ ASSERT_EQ (mStatus, MAMA_STATUS_OK) << "Failed getting Vector Bool";
+ EXPECT_EQ (0, mOut[0]);
+ EXPECT_EQ (1, mOut[1]);
+ EXPECT_EQ (VECTOR_SIZE, mSize);
}

TEST_F(MsgFieldVectorBoolTests, DISABLED_GetVectorBoolNullField)
{
- /* getVectorBool is declared in msgfield.h but not defined */
+ mStatus = mamaMsgField_getVectorBool (NULL, &mOut, &mSize);
+ EXPECT_EQ (MAMA_STATUS_NULL_ARG, mStatus);
}

-TEST_F(MsgFieldVectorBoolTests, DISABLED_GetVectorBoolNullVector)
+TEST_F(MsgFieldVectorBoolTests, GetVectorBoolNullVector)
{
- /* getVectorBool is declared in msgfield.h but not defined */
+ mStatus = mamaMsg_getField (mMsg, NULL, 1, &mField);
+ ASSERT_EQ (MAMA_STATUS_OK, mStatus) << "Failed getting field";
+ mStatus = mamaMsgField_getVectorBool (mField, NULL, &mSize);
+ EXPECT_EQ (MAMA_STATUS_NULL_ARG, mStatus);
}

+
/*
* CHAR TEST SUITE
* ****************************************************************************
@@ -168,7 +181,7 @@ TEST_F(MsgFieldVectorCharTests, DISABLED_GetVectorCharNullField)
EXPECT_EQ (mStatus, MAMA_STATUS_NULL_ARG);
}

-TEST_F(MsgFieldVectorCharTests, DISABLED_GetVectorCharNullVector)
+TEST_F(MsgFieldVectorCharTests, GetVectorCharNullVector)
{
mamaMsg_getField (mMsg, NULL, 1, &mField);
mStatus = mamaMsgField_getVectorChar (mField, NULL, &mSize);
diff --git a/mama/c_cpp/src/gunittest/c/mamamsg/msgvectortests.cpp b/mama/c_cpp/src/gunittest/c/mamamsg/msgvectortests.cpp
index 8cd03b9..b72fa68 100644
--- a/mama/c_cpp/src/gunittest/c/mamamsg/msgvectortests.cpp
+++ b/mama/c_cpp/src/gunittest/c/mamamsg/msgvectortests.cpp
@@ -125,7 +125,7 @@ TEST_F(MsgVectorBoolTestsC, AddVectorBool)
&mOutSize);

EXPECT_EQ( mStatus, MAMA_STATUS_OK );
- // EXPECT_EQ( 0, ::memcmp( mIn, mOut, (sizeof(mama_bool_t) * VECTOR_SIZE) ) );
+ EXPECT_EQ( 0, ::memcmp( mIn, mOut, (sizeof(mama_bool_t) * VECTOR_SIZE) ) );
EXPECT_EQ( mOutSize, VECTOR_SIZE );
}

diff --git a/mama/c_cpp/src/gunittest/c/payload/fieldvectortests.cpp b/mama/c_cpp/src/gunittest/c/payload/fieldvectortests.cpp
index 9c701c8..4429347 100644
--- a/mama/c_cpp/src/gunittest/c/payload/fieldvectortests.cpp
+++ b/mama/c_cpp/src/gunittest/c/payload/fieldvectortests.cpp
@@ -118,19 +118,22 @@ TEST_F(FieldVectorBoolTests, GetVectorBool)
{
m_payloadBridge->msgPayloadGetField (m_msg, NULL, 1, &m_field);
m_status = m_payloadBridge->msgFieldPayloadGetVectorBool(m_field, &m_out, &m_size);
- ASSERT_EQ (MAMA_STATUS_NOT_IMPLEMENTED, m_status);
+ ASSERT_EQ (MAMA_STATUS_OK, m_status);
+ ASSERT_EQ (1, m_out[0]);
+ ASSERT_EQ (0, m_out[1]);
+ ASSERT_EQ ((mama_size_t) VECTOR_SIZE * sizeof(mama_bool_t), m_size);
}

TEST_F(FieldVectorBoolTests, GetVectorBoolNullOut)
{
m_status = m_payloadBridge->msgFieldPayloadGetVectorBool(m_field, NULL, &m_size);
- ASSERT_EQ (MAMA_STATUS_NOT_IMPLEMENTED, m_status);
+ ASSERT_EQ (MAMA_STATUS_NULL_ARG, m_status);
}

TEST_F(FieldVectorBoolTests, GetVectorBoolNullSize)
{
m_status = m_payloadBridge->msgFieldPayloadGetVectorBool(m_field, &m_out, NULL);
- ASSERT_EQ (MAMA_STATUS_NOT_IMPLEMENTED, m_status);
+ ASSERT_EQ (MAMA_STATUS_NULL_ARG, m_status);
}

/**
diff --git a/mama/c_cpp/src/gunittest/cpp/fieldcache/MamaFieldCacheFieldTypesTest.cpp b/mama/c_cpp/src/gunittest/cpp/fieldcache/MamaFieldCacheFieldTypesTest.cpp
index ee4c6b1..da62656 100644
--- a/mama/c_cpp/src/gunittest/cpp/fieldcache/MamaFieldCacheFieldTypesTest.cpp
+++ b/mama/c_cpp/src/gunittest/cpp/fieldcache/MamaFieldCacheFieldTypesTest.cpp
@@ -499,6 +499,86 @@ TEST_F(MamaFieldCacheFieldTypesTest, testDateTime)
ASSERT_DOUBLE_EQ(2500, value.getEpochTimeSeconds());
}

+TEST_F(MamaFieldCacheFieldTypesTest, testBoolVector)
+{
+ MamaFieldCacheField fieldBase;
+ fieldBase.create(1, MAMA_FIELD_TYPE_VECTOR_BOOL, "");
+ MamaFieldCacheFieldBoolVector field;
+
+ mama_bool_t values[5] = { 0, 1, 0, 1, 1 };
+ field.set(fieldBase, values, 5);
+ ASSERT_EQ(0, field.get(fieldBase, 0));
+ ASSERT_EQ(1, field.get(fieldBase, 1));
+ ASSERT_EQ(0, field.get(fieldBase, 2));
+ ASSERT_EQ(1, field.get(fieldBase, 3));
+ ASSERT_EQ(1, field.get(fieldBase, 4));
+
+ const mama_bool_t* result = NULL;
+ mama_size_t size;
+ field.get(fieldBase, result, size);
+ ASSERT_EQ(5, size);
+ ASSERT_EQ(0, result[0]);
+ ASSERT_EQ(1, result[1]);
+ ASSERT_EQ(0, result[2]);
+ ASSERT_EQ(1, result[3]);
+ ASSERT_EQ(1, result[4]);
+ getFieldValue(fieldBase, result, size);
+ ASSERT_EQ(5, size);
+ ASSERT_EQ(0, result[0]);
+ ASSERT_EQ(1, result[1]);
+ ASSERT_EQ(0, result[2]);
+ ASSERT_EQ(1, result[3]);
+ ASSERT_EQ(1, result[4]);
+
+ values[2] = 1;
+ setFieldValue(fieldBase, values, 5);
+ ASSERT_EQ(0, field.get(fieldBase, 0));
+ ASSERT_EQ(1, field.get(fieldBase, 1));
+ ASSERT_EQ(1, field.get(fieldBase, 2));
+ ASSERT_EQ(1, field.get(fieldBase, 3));
+ ASSERT_EQ(1, field.get(fieldBase, 4));
+}
+
+TEST_F(MamaFieldCacheFieldTypesTest, testCharVector)
+{
+ MamaFieldCacheField fieldBase;
+ fieldBase.create(1, MAMA_FIELD_TYPE_VECTOR_CHAR, "");
+ MamaFieldCacheFieldI8Vector field;
+
+ mama_i8_t values[5] = { 'E', 'F', 'V', 'H', 'I' };
+ field.set(fieldBase, values, 5);
+ ASSERT_EQ('E', field.get(fieldBase, 0));
+ ASSERT_EQ('F', field.get(fieldBase, 1));
+ ASSERT_EQ('V', field.get(fieldBase, 2));
+ ASSERT_EQ('H', field.get(fieldBase, 3));
+ ASSERT_EQ('I', field.get(fieldBase, 4));
+
+ const mama_i8_t* result = NULL;
+ mama_size_t size;
+ field.get(fieldBase, result, size);
+ ASSERT_EQ(5, size);
+ ASSERT_EQ('E', result[0]);
+ ASSERT_EQ('F', result[1]);
+ ASSERT_EQ('V', result[2]);
+ ASSERT_EQ('H', result[3]);
+ ASSERT_EQ('I', result[4]);
+ getFieldValue(fieldBase, result, size);
+ ASSERT_EQ(5, size);
+ ASSERT_EQ('E', result[0]);
+ ASSERT_EQ('F', result[1]);
+ ASSERT_EQ('V', result[2]);
+ ASSERT_EQ('H', result[3]);
+ ASSERT_EQ('I', result[4]);
+
+ values[2] = 'G';
+ setFieldValue(fieldBase, values, 5);
+ ASSERT_EQ('E', field.get(fieldBase, 0));
+ ASSERT_EQ('F', field.get(fieldBase, 1));
+ ASSERT_EQ('G', field.get(fieldBase, 2));
+ ASSERT_EQ('H', field.get(fieldBase, 3));
+ ASSERT_EQ('I', field.get(fieldBase, 4));
+}
+
TEST_F(MamaFieldCacheFieldTypesTest, testI8Vector)
{
MamaFieldCacheField fieldBase;
--
1.9.3


[PATCH 2.3.1 3/5] QPID: Add support for Vector Bool and Vector Char field types.

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Signed-off-by: Alireza Assadzadeh <Alireza.Assadzadeh@...>
---
mama/c_cpp/src/c/payload/qpidmsg/field.c | 12 +++++++++++-
mama/c_cpp/src/c/payload/qpidmsg/payload.c | 20 ++++++++++++++++++--
2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/mama/c_cpp/src/c/payload/qpidmsg/field.c b/mama/c_cpp/src/c/payload/qpidmsg/field.c
index ae988e9..49ac087 100644
--- a/mama/c_cpp/src/c/payload/qpidmsg/field.c
+++ b/mama/c_cpp/src/c/payload/qpidmsg/field.c
@@ -919,7 +919,7 @@ qpidmsgFieldPayload_getVectorBool (const msgFieldPayload field,
const mama_bool_t** result,
mama_size_t* size)
{
- return MAMA_STATUS_NOT_IMPLEMENTED;
+ GET_VECTOR_FIELD (_bool, mama_bool_t);
}

mama_status
@@ -1264,6 +1264,16 @@ qpidmsgFieldPayload_getAsString (const msgFieldPayload field,
long long unsigned);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ EXPAND_PRINT_VECTOR_MACROS (mama_bool_t, Bool, "%u", mama_bool_t);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ EXPAND_PRINT_VECTOR_MACROS (char, Char, "%c", char);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
EXPAND_PRINT_VECTOR_MACROS (mama_i8_t, I8, "%d", mama_i8_t);
diff --git a/mama/c_cpp/src/c/payload/qpidmsg/payload.c b/mama/c_cpp/src/c/payload/qpidmsg/payload.c
index 09daab4..2e69769 100644
--- a/mama/c_cpp/src/c/payload/qpidmsg/payload.c
+++ b/mama/c_cpp/src/c/payload/qpidmsg/payload.c
@@ -1166,6 +1166,16 @@ qpidmsgPayload_apply (msgPayload dest,
UPDATE_VECTOR_FIELD (U8, mama_u8_t);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ UPDATE_VECTOR_FIELD (Bool, mama_bool_t);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ UPDATE_VECTOR_FIELD (Char, char);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
UPDATE_VECTOR_FIELD (I8, mama_i8_t);
@@ -3733,6 +3743,12 @@ qpidmsgPayloadImpl_addFieldToPayload (msgPayload msg,
return status;
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ ADD_VECTOR_FIELD_VALUE_TO_MESSAGE(Bool, mama_bool_t);
+ break;
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ ADD_VECTOR_FIELD_VALUE_TO_MESSAGE(Char, char);
+ break;
case MAMA_FIELD_TYPE_VECTOR_I8:
ADD_VECTOR_FIELD_VALUE_TO_MESSAGE(I8, mama_i8_t);
break;
@@ -3912,14 +3928,14 @@ qpidmsgPayloadImpl_arrayToMamaType (pn_type_t type)
switch(type)
{
case PN_NULL: return MAMA_FIELD_TYPE_UNKNOWN;
- case PN_BOOL: return MAMA_FIELD_TYPE_VECTOR_U8;
+ case PN_BOOL: return MAMA_FIELD_TYPE_VECTOR_BOOL;
case PN_UBYTE: return MAMA_FIELD_TYPE_VECTOR_U8;
case PN_BYTE: return MAMA_FIELD_TYPE_VECTOR_I8;
case PN_USHORT: return MAMA_FIELD_TYPE_VECTOR_U16;
case PN_SHORT: return MAMA_FIELD_TYPE_VECTOR_I16;
case PN_UINT: return MAMA_FIELD_TYPE_VECTOR_U32;
case PN_INT: return MAMA_FIELD_TYPE_VECTOR_I32;
- case PN_CHAR: return MAMA_FIELD_TYPE_VECTOR_U8;
+ case PN_CHAR: return MAMA_FIELD_TYPE_VECTOR_CHAR;
case PN_ULONG: return MAMA_FIELD_TYPE_VECTOR_U64;
case PN_LONG: return MAMA_FIELD_TYPE_VECTOR_I64;
case PN_TIMESTAMP: return MAMA_FIELD_TYPE_VECTOR_TIME;
--
1.9.3


[PATCH 2.3.1 2/5] MAMACPP: Complete support of Vector Bool and Vector Char field types.

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Update MAMACPP for Mama message field, cache field, and cache field
types to complete support of Vector Bool and Vector Char.

Signed-off-by: Alireza Assadzadeh <Alireza.Assadzadeh@...>
---
mama/c_cpp/src/cpp/MamaMsgField.cpp | 6 +++
.../src/cpp/fieldcache/MamaFieldCacheField.cpp | 2 +
.../cpp/fieldcache/MamaFieldCacheFieldTypes.cpp | 60 ++++++++++++++++++++++
mama/c_cpp/src/cpp/mama/MamaMsgField.h | 9 ++++
.../cpp/mama/fieldcache/MamaFieldCacheFieldTypes.h | 36 +++++++++++++
5 files changed, 113 insertions(+)

diff --git a/mama/c_cpp/src/cpp/MamaMsgField.cpp b/mama/c_cpp/src/cpp/MamaMsgField.cpp
index 0898825..f2f287c 100644
--- a/mama/c_cpp/src/cpp/MamaMsgField.cpp
+++ b/mama/c_cpp/src/cpp/MamaMsgField.cpp
@@ -242,6 +242,12 @@ namespace Wombat
mamaTry (mamaMsgField_getDateTime (mField, result.getCValue()));
}

+ void MamaMsgField::getVectorBool (const mama_bool_t*& result,
+ size_t& resultLen) const
+ {
+ mamaTry (mamaMsgField_getVectorBool (mField, &result, &resultLen));
+ }
+
void MamaMsgField::getVectorChar (const char*& result,
size_t& resultLen) const
{
diff --git a/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheField.cpp b/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheField.cpp
index ee785f7..69d5de9 100644
--- a/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheField.cpp
+++ b/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheField.cpp
@@ -198,6 +198,8 @@ bool MamaFieldCacheField::isVector() const
{
switch (getType())
{
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
case MAMA_FIELD_TYPE_VECTOR_I8:
case MAMA_FIELD_TYPE_VECTOR_U8:
case MAMA_FIELD_TYPE_VECTOR_I16:
diff --git a/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheFieldTypes.cpp b/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheFieldTypes.cpp
index 0a02613..c1a64d7 100644
--- a/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheFieldTypes.cpp
+++ b/mama/c_cpp/src/cpp/fieldcache/MamaFieldCacheFieldTypes.cpp
@@ -273,6 +273,66 @@ const MamaDateTime& MamaFieldCacheFieldDateTime::get(const MamaFieldCacheField&
return mDateTime;
}

+// MAMA_FIELD_TYPE_VECTOR_BOOL
+template <>
+void MamaFieldCacheFieldBoolVector::set(MamaFieldCacheField& field,
+ const mama_bool_t* values,
+ mama_size_t size)
+{
+ checkType(field);
+ mamaFieldCacheField_setBoolVector(field.getCValue(), values, size);
+}
+template <>
+void MamaFieldCacheFieldBoolVector::get(const MamaFieldCacheField& field,
+ const mama_bool_t*& values,
+ mama_size_t& size) const
+{
+ checkType(field);
+ mamaFieldCacheField_getBoolVector(field.getCValue(), &values, &size);
+}
+template <>
+const mama_bool_t& MamaFieldCacheFieldBoolVector::get(const MamaFieldCacheField& field,
+ mama_size_t index) const
+{
+ checkType(field);
+ const mama_bool_t* values = NULL;
+ mama_size_t size = 0;
+ mamaFieldCacheField_getBoolVector(field.getCValue(), &values, &size);
+ if (index < size)
+ return values[index];
+ throw std::out_of_range("MamaFieldCacheFieldBoolVector::get");
+}
+
+// MAMA_FIELD_TYPE_VECTOR_CHAR
+template <>
+void MamaFieldCacheFieldCharVector::set(MamaFieldCacheField& field,
+ const char* values,
+ mama_size_t size)
+{
+ checkType(field);
+ mamaFieldCacheField_setCharVector(field.getCValue(), values, size);
+}
+template <>
+void MamaFieldCacheFieldCharVector::get(const MamaFieldCacheField& field,
+ const char*& values,
+ mama_size_t& size) const
+{
+ checkType(field);
+ mamaFieldCacheField_getCharVector(field.getCValue(), &values, &size);
+}
+template <>
+const char& MamaFieldCacheFieldCharVector::get(const MamaFieldCacheField& field,
+ mama_size_t index) const
+{
+ checkType(field);
+ const char* values = NULL;
+ mama_size_t size = 0;
+ mamaFieldCacheField_getCharVector(field.getCValue(), &values, &size);
+ if (index < size)
+ return values[index];
+ throw std::out_of_range("MamaFieldCacheFieldCharVector::get");
+}
+
// MAMA_FIELD_TYPE_VECTOR_I8
template <>
void MamaFieldCacheFieldI8Vector::set(MamaFieldCacheField& field,
diff --git a/mama/c_cpp/src/cpp/mama/MamaMsgField.h b/mama/c_cpp/src/cpp/mama/MamaMsgField.h
index b81a844..f763dca 100644
--- a/mama/c_cpp/src/cpp/mama/MamaMsgField.h
+++ b/mama/c_cpp/src/cpp/mama/MamaMsgField.h
@@ -201,6 +201,15 @@ namespace Wombat
MamaMsg& result) const;

/**
+ * Get a vector of boolean.
+ * @param result (out) the vector.
+ * @param resultLen (out) the size of the vector.
+ */
+ void getVectorBool (
+ const mama_bool_t*& result,
+ mama_size_t& resultLen) const;
+
+ /**
* Get a vector of characters.
* @param result (out) the vector.
* @param resultLen (out) the size of the vector.
diff --git a/mama/c_cpp/src/cpp/mama/fieldcache/MamaFieldCacheFieldTypes.h b/mama/c_cpp/src/cpp/mama/fieldcache/MamaFieldCacheFieldTypes.h
index 79c8713..fe164df 100644
--- a/mama/c_cpp/src/cpp/mama/fieldcache/MamaFieldCacheFieldTypes.h
+++ b/mama/c_cpp/src/cpp/mama/fieldcache/MamaFieldCacheFieldTypes.h
@@ -278,6 +278,18 @@ protected:
};

/**
+ * MamaFieldCacheFieldBoolVector.
+ * Class used to set and get the value of a mama_bool_t vector <code>MamaFieldCacheField</code>.
+ */
+typedef MamaFieldCacheFieldVectorBasic<mama_bool_t, MAMA_FIELD_TYPE_VECTOR_BOOL>
+ MamaFieldCacheFieldBoolVector;
+/**
+ * MamaFieldCacheFieldCharVector.
+ * Class used to set and get the value of a char vector <code>MamaFieldCacheField</code>.
+ */
+typedef MamaFieldCacheFieldVectorBasic<char, MAMA_FIELD_TYPE_VECTOR_CHAR>
+ MamaFieldCacheFieldCharVector;
+/**
* MamaFieldCacheFieldI8Vector.
* Class used to set and get the value of a mama_i8_t vector <code>MamaFieldCacheField</code>.
*/
@@ -887,6 +899,18 @@ void setFieldValue(MamaFieldCacheField& field, const T* values, mama_size_t size
{
switch(field.getType())
{
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ MamaFieldCacheFieldBoolVector getField;
+ getField.set(field, (const mama_bool_t*)values, size);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ MamaFieldCacheFieldCharVector getField;
+ getField.set(field, (const char*)values, size);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
MamaFieldCacheFieldI8Vector getField;
@@ -999,6 +1023,18 @@ void getFieldValue(const MamaFieldCacheField& field, const T*& values, mama_size
{
switch(field.getType())
{
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ MamaFieldCacheFieldBoolVector getField;
+ getField.get(field, (const mama_bool_t*&)values, size);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ MamaFieldCacheFieldCharVector getField;
+ getField.get(field, (const char*&)values, size);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
MamaFieldCacheFieldI8Vector getField;
--
1.9.3


[PATCH 2.3.1 1/5] MAMAC: Complete support of Vector Bool and Vector Char field types.

Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Add enumerator for Vector Bool and Vector Char for mamaFieldType and
complete the corresponding changes in MAMAC for using these two types.

Signed-off-by: Alireza Assadzadeh <Alireza.Assadzadeh@...>
---

I have raised bug http://bugs.openmama.org/show_bug.cgi?id=168 to track
this issue and attached the patches to the bug.

The patches are against 'next' branch. They are tested by using gunittests,
and sample programs (capturereplayc, mamalistenc and bookticker).

mama/c_cpp/src/c/dictionary.c | 8 +++
mama/c_cpp/src/c/fieldcache/fieldcachefield.c | 82 ++++++++++++++++++++++
mama/c_cpp/src/c/fieldcache/fieldcacheimpl.c | 42 +++++++++++
mama/c_cpp/src/c/fielddesc.c | 8 +++
mama/c_cpp/src/c/mama/fieldcache/fieldcachefield.h | 65 +++++++++++++++++
mama/c_cpp/src/c/mama/fielddesc.h | 2 +
mama/c_cpp/src/c/msgfield.c | 18 +++++
7 files changed, 225 insertions(+)

diff --git a/mama/c_cpp/src/c/dictionary.c b/mama/c_cpp/src/c/dictionary.c
index 7f7d605..effa28a 100644
--- a/mama/c_cpp/src/c/dictionary.c
+++ b/mama/c_cpp/src/c/dictionary.c
@@ -952,6 +952,8 @@ void populateMessageFromDictionary (mamaDictionaryImpl* impl,
int i = 0;
mama_status status = MAMA_STATUS_OK;

+ const mama_bool_t bool_vector[] = {0};
+ const char char_vector[] = {' '};
const mama_i8_t i8_vector[] = {1};
const mama_u8_t u8_vector[] = {1};
const mama_i16_t i16_vector[] = {1};
@@ -1048,6 +1050,12 @@ void populateMessageFromDictionary (mamaDictionaryImpl* impl,
case MAMA_FIELD_TYPE_PRICE:
ADD_TO_DICT (Price, price);
break;
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ ADD_VECTOR_TO_DICT (Bool, bool_vector);
+ break;
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ ADD_VECTOR_TO_DICT (Char, char_vector);
+ break;
case MAMA_FIELD_TYPE_VECTOR_I8:
ADD_VECTOR_TO_DICT (I8, i8_vector);
break;
diff --git a/mama/c_cpp/src/c/fieldcache/fieldcachefield.c b/mama/c_cpp/src/c/fieldcache/fieldcachefield.c
index 43a3c05..89389fd 100644
--- a/mama/c_cpp/src/c/fieldcache/fieldcachefield.c
+++ b/mama/c_cpp/src/c/fieldcache/fieldcachefield.c
@@ -273,6 +273,22 @@ mamaFieldCacheField_copy(const mamaFieldCacheField field, mamaFieldCacheField co
mamaFieldCacheField_setDateTime(copy, value);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* values = NULL;
+ mama_size_t size;
+ mamaFieldCacheField_getBoolVector(field, &values, &size);
+ mamaFieldCacheField_setBoolVector(copy, values, size);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* values = NULL;
+ mama_size_t size;
+ mamaFieldCacheField_getCharVector(field, &values, &size);
+ mamaFieldCacheField_setCharVector(copy, values, size);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const mama_i8_t* values = NULL;
@@ -728,6 +744,40 @@ mama_status mamaFieldCacheField_getDateTime(const mamaFieldCacheField field,
return MAMA_STATUS_OK;
}

+mama_status mamaFieldCacheField_getBoolVector(const mamaFieldCacheField field,
+ const mama_bool_t** values,
+ mama_size_t* size)
+{
+ if (!field || !values || !size)
+ {
+ return MAMA_STATUS_NULL_ARG;
+ }
+ if (field->mType != MAMA_FIELD_TYPE_VECTOR_BOOL)
+ {
+ return MAMA_STATUS_INVALID_ARG;
+ }
+ *values = (mama_bool_t*)field->mData.data; /* NOT COPYING */
+ *size = field->mVectorSize;
+ return MAMA_STATUS_OK;
+}
+
+mama_status mamaFieldCacheField_getCharVector(const mamaFieldCacheField field,
+ const char** values,
+ mama_size_t* size)
+{
+ if (!field || !values || !size)
+ {
+ return MAMA_STATUS_NULL_ARG;
+ }
+ if (field->mType != MAMA_FIELD_TYPE_VECTOR_CHAR)
+ {
+ return MAMA_STATUS_INVALID_ARG;
+ }
+ *values = (char*)field->mData.data; /* NOT COPYING */
+ *size = field->mVectorSize;
+ return MAMA_STATUS_OK;
+}
+
mama_status mamaFieldCacheField_getI8Vector(const mamaFieldCacheField field,
const mama_i8_t** values,
mama_size_t* size)
@@ -1223,6 +1273,38 @@ mama_status mamaFieldCacheField_setDateTime(const mamaFieldCacheField field,
return MAMA_STATUS_OK;
}

+mama_status mamaFieldCacheField_setBoolVector(const mamaFieldCacheField field,
+ const mama_bool_t* values,
+ mama_size_t size)
+{
+ if (!field || !values)
+ {
+ return MAMA_STATUS_NULL_ARG;
+ }
+ if (field->mType != MAMA_FIELD_TYPE_VECTOR_BOOL)
+ {
+ return MAMA_STATUS_INVALID_ARG;
+ }
+ field->mVectorSize = size;
+ return mamaFieldCacheField_setDataValue(field, values, size * sizeof(mama_bool_t));
+}
+
+mama_status mamaFieldCacheField_setCharVector(const mamaFieldCacheField field,
+ const char* values,
+ mama_size_t size)
+{
+ if (!field || !values)
+ {
+ return MAMA_STATUS_NULL_ARG;
+ }
+ if (field->mType != MAMA_FIELD_TYPE_VECTOR_CHAR)
+ {
+ return MAMA_STATUS_INVALID_ARG;
+ }
+ field->mVectorSize = size;
+ return mamaFieldCacheField_setDataValue(field, values, size * sizeof(char));
+}
+
mama_status mamaFieldCacheField_setI8Vector(const mamaFieldCacheField field,
const mama_i8_t* values,
mama_size_t size)
diff --git a/mama/c_cpp/src/c/fieldcache/fieldcacheimpl.c b/mama/c_cpp/src/c/fieldcache/fieldcacheimpl.c
index 48cbf20..1d7d7a9 100644
--- a/mama/c_cpp/src/c/fieldcache/fieldcacheimpl.c
+++ b/mama/c_cpp/src/c/fieldcache/fieldcacheimpl.c
@@ -183,6 +183,22 @@ mama_status mamaFieldCache_updateCacheFromMsgField(mamaFieldCache fieldCache,
mamaFieldCacheField_setDateTime(field, fieldCache->mReusableDateTime);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* values = NULL;
+ mama_size_t size = 0;
+ mamaMsgField_getVectorBool(messageField, &values, &size);
+ mamaFieldCacheField_setBoolVector(field, values, size);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* values = NULL;
+ mama_size_t size = 0;
+ mamaMsgField_getVectorChar(messageField, &values, &size);
+ mamaFieldCacheField_setCharVector(field, values, size);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const mama_i8_t* values = NULL;
@@ -502,6 +518,32 @@ mama_status mamaFieldCache_updateMsgField(mamaFieldCache fieldCache,
: mamaMsg_addDateTime(message, name, fid, value);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* values = NULL;
+ mama_size_t size = 0;
+ mamaFieldCacheField_getBoolVector(field, &values, &size);
+ if (!values)
+ {
+ return MAMA_STATUS_INVALID_ARG;
+ }
+ status = useUpdate ? mamaMsg_updateVectorBool(message, name, fid, values, size)
+ : mamaMsg_addVectorBool(message, name, fid, values, size);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* values = NULL;
+ mama_size_t size = 0;
+ mamaFieldCacheField_getCharVector(field, &values, &size);
+ if (!values)
+ {
+ return MAMA_STATUS_INVALID_ARG;
+ }
+ status = useUpdate ? mamaMsg_updateVectorChar(message, name, fid, values, size)
+ : mamaMsg_addVectorChar(message, name, fid, values, size);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const mama_i8_t* values = NULL;
diff --git a/mama/c_cpp/src/c/fielddesc.c b/mama/c_cpp/src/c/fielddesc.c
index a948567..1f08e01 100644
--- a/mama/c_cpp/src/c/fielddesc.c
+++ b/mama/c_cpp/src/c/fielddesc.c
@@ -196,6 +196,10 @@ mamaFieldTypeToString (mamaFieldType type)
return "TIME";
case MAMA_FIELD_TYPE_PRICE:
return "PRICE";
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ return "VECTOR_BOOL";
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ return "VECTOR_CHAR";
case MAMA_FIELD_TYPE_VECTOR_I8:
return "VECTOR_I8";
case MAMA_FIELD_TYPE_VECTOR_U8:
@@ -270,6 +274,10 @@ stringToMamaFieldType (const char* str)
return MAMA_FIELD_TYPE_TIME;
if (strcmp(str, "PRICE") == 0)
return MAMA_FIELD_TYPE_PRICE;
+ if (strcmp(str, "VECTOR_BOOL") == 0)
+ return MAMA_FIELD_TYPE_VECTOR_BOOL;
+ if (strcmp(str, "VECTOR_CHAR") == 0)
+ return MAMA_FIELD_TYPE_VECTOR_CHAR;
if (strcmp(str, "VECTOR_I8") == 0)
return MAMA_FIELD_TYPE_VECTOR_I8;
if (strcmp(str, "VECTOR_U8") == 0)
diff --git a/mama/c_cpp/src/c/mama/fieldcache/fieldcachefield.h b/mama/c_cpp/src/c/mama/fieldcache/fieldcachefield.h
index 55dbd9b..a9ca40f 100644
--- a/mama/c_cpp/src/c/mama/fieldcache/fieldcachefield.h
+++ b/mama/c_cpp/src/c/mama/fieldcache/fieldcachefield.h
@@ -442,6 +442,40 @@ mamaFieldCacheField_getDateTime(const mamaFieldCacheField field,
const mamaDateTime* result);

/**
+ * This function will get the values a <code>mamaFieldCacheField</code> of type Bool vector.
+ *
+ * @param field (in) The field.
+ * @param values (out) The array of values of the field.
+ * @param size (out) The number of values.
+ * @return Resulting status of the call which can be
+ * MAMA_STATUS_NULL_ARG
+ * MAMA_STATUS_INVALID_ARG
+ * MAMA_STATUS_OK
+ */
+MAMAExpDLL
+extern mama_status
+mamaFieldCacheField_getBoolVector(const mamaFieldCacheField field,
+ const mama_bool_t** values,
+ mama_size_t* size);
+/**
+ * This function will get the values a <code>mamaFieldCacheField</code> of type Char vector.
+ *
+ * @param field (in) The field.
+ * @param values (out) The array of values of the field.
+ * @param size (out) The number of values.
+ * @return Resulting status of the call which can be
+ * MAMA_STATUS_NULL_ARG
+ * MAMA_STATUS_INVALID_ARG
+ * MAMA_STATUS_OK
+ */
+MAMAExpDLL
+extern mama_status
+mamaFieldCacheField_getCharVector(const mamaFieldCacheField field,
+ const char** values,
+ mama_size_t* size);
+
+
+/**
* This function will get the values a <code>mamaFieldCacheField</code> of type I8 vector.
*
* @param field (in) The field.
@@ -879,6 +913,37 @@ mamaFieldCacheField_setDateTime(const mamaFieldCacheField field,
const mamaDateTime value);

/**
+ * This function will set the values of a <code>mamaFieldCacheField</code> of type Bool vector.
+ *
+ * @param field (in) The field to set the value to.
+ * @param value (in) The new value of the field.
+ * @return Resulting status of the call which can be
+ * MAMA_STATUS_NULL_ARG
+ * MAMA_STATUS_INVALID_ARG
+ * MAMA_STATUS_OK
+ */
+MAMAExpDLL
+extern mama_status
+mamaFieldCacheField_setBoolVector(const mamaFieldCacheField field,
+ const mama_bool_t* values,
+ mama_size_t size);
+/**
+ * This function will set the values of a <code>mamaFieldCacheField</code> of type Char vector.
+ *
+ * @param field (in) The field to set the value to.
+ * @param value (in) The new value of the field.
+ * @return Resulting status of the call which can be
+ * MAMA_STATUS_NULL_ARG
+ * MAMA_STATUS_INVALID_ARG
+ * MAMA_STATUS_OK
+ */
+MAMAExpDLL
+extern mama_status
+mamaFieldCacheField_setCharVector(const mamaFieldCacheField field,
+ const char* values,
+ mama_size_t size);
+
+/**
* This function will set the values of a <code>mamaFieldCacheField</code> of type I8 vector.
*
* @param field (in) The field to set the value to.
diff --git a/mama/c_cpp/src/c/mama/fielddesc.h b/mama/c_cpp/src/c/mama/fielddesc.h
index e3af6e1..a374489 100644
--- a/mama/c_cpp/src/c/mama/fielddesc.h
+++ b/mama/c_cpp/src/c/mama/fielddesc.h
@@ -90,6 +90,8 @@ typedef enum mamaFieldType_
MAMA_FIELD_TYPE_PRICE = 27,

/** Array type support */
+ MAMA_FIELD_TYPE_VECTOR_BOOL = 29,
+ MAMA_FIELD_TYPE_VECTOR_CHAR = 30,
MAMA_FIELD_TYPE_VECTOR_I8 = 34,
MAMA_FIELD_TYPE_VECTOR_U8 = 35,
MAMA_FIELD_TYPE_VECTOR_I16 = 36,
diff --git a/mama/c_cpp/src/c/msgfield.c b/mama/c_cpp/src/c/msgfield.c
index 904a365..52fda4f 100644
--- a/mama/c_cpp/src/c/msgfield.c
+++ b/mama/c_cpp/src/c/msgfield.c
@@ -486,6 +486,24 @@ mamaMsgField_getMsg (
}

mama_status
+mamaMsgField_getVectorBool (
+ const mamaMsgField msgField,
+ const mama_bool_t** result,
+ size_t* size)
+{
+ mamaMsgFieldImpl* impl =
+ (mamaMsgFieldImpl*)(msgField);
+ if (!impl) return MAMA_STATUS_INVALID_ARG;
+
+ if (impl->myPayloadBridge)
+ {
+ return impl->myPayloadBridge->msgFieldPayloadGetVectorBool (
+ impl->myPayload, result, size);
+ }
+ return MAMA_STATUS_NULL_ARG;
+}
+
+mama_status
mamaMsgField_getVectorChar (
const mamaMsgField msgField,
const char** result,
--
1.9.3


Possible bug with MamaSubscription.java

Chad Meyer
 

Hi,

 

I’ve been testing the setupSubscription and createSubscription methods found in MamaSubscription.java. Key difference between the two is that setupSubscription is used when a subscription is created but not activated yet where createSubscription creates and activates the subscription.

 

In the setupSubscription, the closure is passed into the JNI layer instead of saving it in the java layer like createSubscription. Without saving this closure in the java layer, the value doesn’t seem to be passed back properly from the JNI layer causing issues.

 

Is this a typo in MamaSubscription.java or is the JNI layer supposed to pass the closure back to the JAVA layer once the subscription is activated?

 

Regards,

 

Chad Meyer | Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Re: [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

Damian Maguire <d.maguire@...>
 

Thanks for the ping Chad, I'll get looking at this as soon as I can and let you know if we have any questions.

Cheers,

Damian

On 23/10/14 15:10, Meyer, Chad J wrote:

Hi Damian,

 

Added comments about a week ago to the Bugzilla ticket referenced below regarding what I did for testing. Please let me know if you need more evidence of testing.

 

Regards,

 

Chad Meyer| Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan| 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

 

From: Damian Maguire [mailto:damian@...]
Sent: Thursday, September 25, 2014 10:09 AM
To: Meyer, Chad J
Cc: Glenn McClements; openmama-dev@...
Subject: Re: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Hey Chad, 

 

I was just taking a look over this again, and decided that I'd stick it into Bugzilla to keep track of it there. If you'd like to sign up for an account you can add yourself as a CC to BZ164. We can follow up with any other required information there (though the main thing outstanding remains some evidence of testing, as mentioned in my previous mail).

 

Cheers, 

 

Damian

 

On Thu, Sep 18, 2014 at 11:56 AM, Damian Maguire <damian@...> wrote:

Cheers for the new patch Chad, looks good. 

 

At this stage we really need two things to progress getting this into OpenMAMA - firstly, can you raise a Bugzilla ticket, just to make it a bit easier to track the progress of the patch. Secondly, can you provide some evidence of testing? Generally we'd ask for unit tests, but the Java framework needs a bit of work, so in this case can you show a simple example application which demonstrates the usage of the new API? 

 

Thanks again for the contribution.

 

Damian

 

On Mon, Sep 15, 2014 at 3:31 PM, Meyer, Chad J <chad.j.meyer@...> wrote:

Hi Glenn,

 

I have applied the changes you recommended and created a new patch. Please see attached.

 

diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c

index 518bacf..aa1c4c6 100644

--- a/mama/jni/src/c/mamapublisherjni.c

+++ b/mama/jni/src/c/mamapublisherjni.c

@@ -76,40 +76,47 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher,

/*

  * Class:     com_wombat_mama_MamaPublisher

  * Method:    _create

- * Signature: (Lcom/wombat/mama/Transport;Ljava/lang/String;)V

+ * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V

  */

JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

-  (JNIEnv* env, jobject this, jobject transport, jstring topic)

+  (JNIEnv* env, jobject this, jobject transport, jstring topic, jstring source)

{

-    mamaPublisher   cPublisher          =   NULL;

+             mamaPublisher   cPublisher          =   NULL;

     mamaTransport   cTransport          =   NULL;

-    const char*     cTopic              =   NULL;

+    const char*     cSource             =   NULL;

+             const char*     cTopic                                                       =   NULL;

     jlong           transportPointer    =   0;

     mama_status     status              =   MAMA_STATUS_OK;

     char errorString[UTILS_MAX_ERROR_STRING_LENGTH];

     /*Get the transport pointer*/

     assert(transport!=NULL);

     transportPointer = (*env)->GetLongField(env, transport,

             transportPointerFieldId_g);

+

     cTransport = CAST_JLONG_TO_POINTER(mamaTransport, transportPointer);

-    assert(transportPointer!=0);

 

+    assert(transportPointer!=0);

     /*Get the char* from the jstring*/

     if(NULL!=topic)

     {

          cTopic = (*env)->GetStringUTFChars(env,topic,0);

          if(!cTopic)return;

     }

-   

+             if(NULL!=source)

+    {

+         cSource = (*env)->GetStringUTFChars(env,source,0);

+         if(!cSource)return;

+    }

+

     if(MAMA_STATUS_OK!=(mamaPublisher_create(

                     &cPublisher,

                     cTransport,

                     cTopic,

-                    NULL,

+                    cSource,

                     NULL)))

     {

-        if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+                             if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+        if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

         utils_buildErrorStringForStatus(

                 errorString, UTILS_MAX_ERROR_STRING_LENGTH,

                 "Failed to create publisher.", status);

@@ -121,6 +128,7 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

                          CAST_POINTER_TO_JLONG(cPublisher));

        

     if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+             if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

    

     return;

}

diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java

index 0146945..31bb1f5 100644

--- a/mama/jni/src/com/wombat/mama/MamaPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java

@@ -34,10 +34,15 @@ public class MamaPublisher

 

     /*A long value containing a pointer to the underlying C publisher structure*/

     private long    publisherPointer_i   =   0;

+            

+             public void create (MamaTransport transport, String topic)

+    {

+        _create(transport,topic,null);

+    }

 

-    public void create (MamaTransport transport, String topic)

+             public void create (MamaTransport transport, String topic, String source)

     {

-        _create(transport,topic);

+        _create(transport,topic,source);

     }

 

     public void send (MamaMsg msg)

@@ -76,7 +81,7 @@ public class MamaPublisher

         _sendFromInbox(inbox,msg);

     }

 

-    private native void _create (MamaTransport transport, String topic);

+    private native void _create (MamaTransport transport, String topic, String source);

 

     private native void _send (MamaMsg msg);

 

--

1.8.4.msysgit.0

 

Regards,

 

Chad Meyer | Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

 

 

From: Glenn McClements [mailto:gmcclements@...]
Sent: Monday, September 08, 2014 7:14 AM
To: Meyer, Chad J; openmama-dev@...
Subject: Re: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Thanks Chad.

 

For consistency though with the C++ interface, it should be (publisher, topic, source), not (publisher, source, topic).  

 

Also consider replacing/extending the existing JNI _create()

function rather than having two. This reduces code duplication and you already check for a NULL source being passed down so it should handle both Java methods. 

 

Glenn 

 

From: <Meyer>, Chad J <chad.j.meyer@...>
Date: Friday, 5 September 2014 22:42
To: "openmama-dev@..." <openmama-dev@...>
Subject: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Hi,

 

Attached is a patch for OpenMAMA JNI that overloads the MamaPublisher create method. For consistency purposes, the new method requires two String parameters, source and symbol, as opposed to a single string currently found in the MamaPublisher class.  

diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c

index 518bacf..629a51b 100644

--- a/mama/jni/src/c/mamapublisherjni.c

+++ b/mama/jni/src/c/mamapublisherjni.c

@@ -78,7 +78,7 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher,

  * Method:    _create

  * Signature: (Lcom/wombat/mama/Transport;Ljava/lang/String;)V

  */

-JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

+JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create__Lcom_wombat_mama_MamaTransport_2Ljava_lang_String_2

   (JNIEnv* env, jobject this, jobject transport, jstring topic)

{

     mamaPublisher   cPublisher          =   NULL;

@@ -125,6 +125,66 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

     return;

}

 

+ /*

+ * Class:     com_wombat_mama_MamaPublisher

+ * Method:    _create

+ * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V

+ */

+JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create__Lcom_wombat_mama_MamaTransport_2Ljava_lang_String_2Ljava_lang_String_2

+  (JNIEnv* env, jobject this, jobject transport, jstring source, jstring symbol)

+{

+             mamaPublisher   cPublisher          =   NULL;

+    mamaTransport   cTransport          =   NULL;

+    const char*     cSource             =   NULL;

+             const char*     cSymbol             =   NULL;

+    jlong           transportPointer    =   0;

+    mama_status     status              =   MAMA_STATUS_OK;

+    char errorString[UTILS_MAX_ERROR_STRING_LENGTH];

+            

+    /*Get the transport pointer*/

+    assert(transport!=NULL);

+    transportPointer = (*env)->GetLongField(env, transport,

+            transportPointerFieldId_g);

+    cTransport = CAST_JLONG_TO_POINTER(mamaTransport, transportPointer);

+    assert(transportPointer!=0);

+            

+    /*Get the char* from the jstring*/

+    if(NULL!=source)

+    {

+         cSource = (*env)->GetStringUTFChars(env,source,0);

+         if(!cSource)return;

+    }

+             if(NULL!=symbol)

+    {

+         cSymbol = (*env)->GetStringUTFChars(env,symbol,0);

+         if(!cSymbol)return;

+    }

+

+    if(MAMA_STATUS_OK!=(mamaPublisher_create(

+                    &cPublisher,

+                    cTransport,

+                    cSymbol,

+                    cSource,

+                    NULL)))

+    {

+        if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

+                             if(cSymbol)(*env)->ReleaseStringUTFChars(env,symbol, cSymbol);

+        utils_buildErrorStringForStatus(

+                errorString, UTILS_MAX_ERROR_STRING_LENGTH,

+                "Failed to create publisher.", status);

+        utils_throwMamaException(env,errorString);

+        return;

+    }

+

+    (*env)->SetLongField(env,this,publisherPointerFieldId_g,

+                         CAST_POINTER_TO_JLONG(cPublisher));

+       

+    if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

+             if(cSymbol)(*env)->ReleaseStringUTFChars(env,symbol, cSymbol);

+   

+    return;

+}

+

/*

  * Class:     com_wombat_mama_MamaPublisher

  * Method:    _send

diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java

index 0146945..c1e8dc8 100644

--- a/mama/jni/src/com/wombat/mama/MamaPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java

@@ -39,6 +39,11 @@ public class MamaPublisher

     {

         _create(transport,topic);

     }

+            

+             public void create (MamaTransport transport, String source, String symbol)

+    {

+        _create(transport,source,symbol);

+    }

     public void send (MamaMsg msg)

     {

@@ -77,6 +82,8 @@ public class MamaPublisher

     }

     private native void _create (MamaTransport transport, String topic);

+            

+             private native void _create (MamaTransport transport, String source, String symbol);

     private native void _send (MamaMsg msg);

--

1.8.4.msysgit.0

 

 

Chad Meyer| Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.

 

_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev

 

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.



Re: [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

Chad Meyer
 

Hi Damian,

 

Added comments about a week ago to the Bugzilla ticket referenced below regarding what I did for testing. Please let me know if you need more evidence of testing.

 

Regards,

 

Chad Meyer | Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

 

From: Damian Maguire [mailto:damian@...]
Sent: Thursday, September 25, 2014 10:09 AM
To: Meyer, Chad J
Cc: Glenn McClements; openmama-dev@...
Subject: Re: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Hey Chad, 

 

I was just taking a look over this again, and decided that I'd stick it into Bugzilla to keep track of it there. If you'd like to sign up for an account you can add yourself as a CC to BZ164. We can follow up with any other required information there (though the main thing outstanding remains some evidence of testing, as mentioned in my previous mail).

 

Cheers, 

 

Damian

 

On Thu, Sep 18, 2014 at 11:56 AM, Damian Maguire <damian@...> wrote:

Cheers for the new patch Chad, looks good. 

 

At this stage we really need two things to progress getting this into OpenMAMA - firstly, can you raise a Bugzilla ticket, just to make it a bit easier to track the progress of the patch. Secondly, can you provide some evidence of testing? Generally we'd ask for unit tests, but the Java framework needs a bit of work, so in this case can you show a simple example application which demonstrates the usage of the new API? 

 

Thanks again for the contribution.

 

Damian

 

On Mon, Sep 15, 2014 at 3:31 PM, Meyer, Chad J <chad.j.meyer@...> wrote:

Hi Glenn,

 

I have applied the changes you recommended and created a new patch. Please see attached.

 

diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c

index 518bacf..aa1c4c6 100644

--- a/mama/jni/src/c/mamapublisherjni.c

+++ b/mama/jni/src/c/mamapublisherjni.c

@@ -76,40 +76,47 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher,

/*

  * Class:     com_wombat_mama_MamaPublisher

  * Method:    _create

- * Signature: (Lcom/wombat/mama/Transport;Ljava/lang/String;)V

+ * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V

  */

JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

-  (JNIEnv* env, jobject this, jobject transport, jstring topic)

+  (JNIEnv* env, jobject this, jobject transport, jstring topic, jstring source)

{

-    mamaPublisher   cPublisher          =   NULL;

+             mamaPublisher   cPublisher          =   NULL;

     mamaTransport   cTransport          =   NULL;

-    const char*     cTopic              =   NULL;

+    const char*     cSource             =   NULL;

+             const char*     cTopic                                                       =   NULL;

     jlong           transportPointer    =   0;

     mama_status     status              =   MAMA_STATUS_OK;

     char errorString[UTILS_MAX_ERROR_STRING_LENGTH];

     /*Get the transport pointer*/

     assert(transport!=NULL);

     transportPointer = (*env)->GetLongField(env, transport,

             transportPointerFieldId_g);

+

     cTransport = CAST_JLONG_TO_POINTER(mamaTransport, transportPointer);

-    assert(transportPointer!=0);

 

+    assert(transportPointer!=0);

     /*Get the char* from the jstring*/

     if(NULL!=topic)

     {

          cTopic = (*env)->GetStringUTFChars(env,topic,0);

          if(!cTopic)return;

     }

-   

+             if(NULL!=source)

+    {

+         cSource = (*env)->GetStringUTFChars(env,source,0);

+         if(!cSource)return;

+    }

+

     if(MAMA_STATUS_OK!=(mamaPublisher_create(

                     &cPublisher,

                     cTransport,

                     cTopic,

-                    NULL,

+                    cSource,

                     NULL)))

     {

-        if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+                             if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+        if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

         utils_buildErrorStringForStatus(

                 errorString, UTILS_MAX_ERROR_STRING_LENGTH,

                 "Failed to create publisher.", status);

@@ -121,6 +128,7 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

                          CAST_POINTER_TO_JLONG(cPublisher));

        

     if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+             if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

    

     return;

}

diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java

index 0146945..31bb1f5 100644

--- a/mama/jni/src/com/wombat/mama/MamaPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java

@@ -34,10 +34,15 @@ public class MamaPublisher

 

     /*A long value containing a pointer to the underlying C publisher structure*/

     private long    publisherPointer_i   =   0;

+            

+             public void create (MamaTransport transport, String topic)

+    {

+        _create(transport,topic,null);

+    }

 

-    public void create (MamaTransport transport, String topic)

+             public void create (MamaTransport transport, String topic, String source)

     {

-        _create(transport,topic);

+        _create(transport,topic,source);

     }

 

     public void send (MamaMsg msg)

@@ -76,7 +81,7 @@ public class MamaPublisher

         _sendFromInbox(inbox,msg);

     }

 

-    private native void _create (MamaTransport transport, String topic);

+    private native void _create (MamaTransport transport, String topic, String source);

 

     private native void _send (MamaMsg msg);

 

--

1.8.4.msysgit.0

 

Regards,

 

Chad Meyer | Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

 

 

From: Glenn McClements [mailto:gmcclements@...]
Sent: Monday, September 08, 2014 7:14 AM
To: Meyer, Chad J; openmama-dev@...
Subject: Re: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Thanks Chad.

 

For consistency though with the C++ interface, it should be (publisher, topic, source), not (publisher, source, topic).  

 

Also consider replacing/extending the existing JNI _create()

function rather than having two. This reduces code duplication and you already check for a NULL source being passed down so it should handle both Java methods. 

 

Glenn 

 

From: <Meyer>, Chad J <chad.j.meyer@...>
Date: Friday, 5 September 2014 22:42
To: "openmama-dev@..." <openmama-dev@...>
Subject: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Hi,

 

Attached is a patch for OpenMAMA JNI that overloads the MamaPublisher create method. For consistency purposes, the new method requires two String parameters, source and symbol, as opposed to a single string currently found in the MamaPublisher class.  

diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c

index 518bacf..629a51b 100644

--- a/mama/jni/src/c/mamapublisherjni.c

+++ b/mama/jni/src/c/mamapublisherjni.c

@@ -78,7 +78,7 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher,

  * Method:    _create

  * Signature: (Lcom/wombat/mama/Transport;Ljava/lang/String;)V

  */

-JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

+JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create__Lcom_wombat_mama_MamaTransport_2Ljava_lang_String_2

   (JNIEnv* env, jobject this, jobject transport, jstring topic)

{

     mamaPublisher   cPublisher          =   NULL;

@@ -125,6 +125,66 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

     return;

}

 

+ /*

+ * Class:     com_wombat_mama_MamaPublisher

+ * Method:    _create

+ * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V

+ */

+JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create__Lcom_wombat_mama_MamaTransport_2Ljava_lang_String_2Ljava_lang_String_2

+  (JNIEnv* env, jobject this, jobject transport, jstring source, jstring symbol)

+{

+             mamaPublisher   cPublisher          =   NULL;

+    mamaTransport   cTransport          =   NULL;

+    const char*     cSource             =   NULL;

+             const char*     cSymbol             =   NULL;

+    jlong           transportPointer    =   0;

+    mama_status     status              =   MAMA_STATUS_OK;

+    char errorString[UTILS_MAX_ERROR_STRING_LENGTH];

+            

+    /*Get the transport pointer*/

+    assert(transport!=NULL);

+    transportPointer = (*env)->GetLongField(env, transport,

+            transportPointerFieldId_g);

+    cTransport = CAST_JLONG_TO_POINTER(mamaTransport, transportPointer);

+    assert(transportPointer!=0);

+            

+    /*Get the char* from the jstring*/

+    if(NULL!=source)

+    {

+         cSource = (*env)->GetStringUTFChars(env,source,0);

+         if(!cSource)return;

+    }

+             if(NULL!=symbol)

+    {

+         cSymbol = (*env)->GetStringUTFChars(env,symbol,0);

+         if(!cSymbol)return;

+    }

+

+    if(MAMA_STATUS_OK!=(mamaPublisher_create(

+                    &cPublisher,

+                    cTransport,

+                    cSymbol,

+                    cSource,

+                    NULL)))

+    {

+        if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

+                             if(cSymbol)(*env)->ReleaseStringUTFChars(env,symbol, cSymbol);

+        utils_buildErrorStringForStatus(

+                errorString, UTILS_MAX_ERROR_STRING_LENGTH,

+                "Failed to create publisher.", status);

+        utils_throwMamaException(env,errorString);

+        return;

+    }

+

+    (*env)->SetLongField(env,this,publisherPointerFieldId_g,

+                         CAST_POINTER_TO_JLONG(cPublisher));

+       

+    if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

+             if(cSymbol)(*env)->ReleaseStringUTFChars(env,symbol, cSymbol);

+   

+    return;

+}

+

/*

  * Class:     com_wombat_mama_MamaPublisher

  * Method:    _send

diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java

index 0146945..c1e8dc8 100644

--- a/mama/jni/src/com/wombat/mama/MamaPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java

@@ -39,6 +39,11 @@ public class MamaPublisher

     {

         _create(transport,topic);

     }

+            

+             public void create (MamaTransport transport, String source, String symbol)

+    {

+        _create(transport,source,symbol);

+    }

     public void send (MamaMsg msg)

     {

@@ -77,6 +82,8 @@ public class MamaPublisher

     }

     private native void _create (MamaTransport transport, String topic);

+            

+             private native void _create (MamaTransport transport, String source, String symbol);

     private native void _send (MamaMsg msg);

--

1.8.4.msysgit.0

 

 

Chad Meyer| Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.

 

_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev

 

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Re: Mama reserved fields as two struct types

Ian Bell <IBell@...>
 

Hi Reed,

 

This difference appears for historical reasons.  A lot of the fields that are not available as field descriptors are no longer used within the platform e.g. MdRvSyncPattern

Can you raise a bugzilla ticket and submit a patch for any fields that you do require which are not available as field descriptors.

 

Thanks

Ian

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Alpert, Reed
Sent: 23 September 2014 21:14
To: Openmama-dev@...
Subject: [Openmama-dev] Mama reserved fields as two struct types

 

Hi,

 

Some reserved fields have both a MamaReservedField & mamaFieldDescriptor, and a larger set have only the MamaReservedField struct which does not have a type.

 

Is there a specific reason for this?

 

We are working on code to xlat an RsslDictionary into a MamaDictionary, and adding the reserved fields would be easier if all of them had just a field descriptor (and if there were a collection of those).

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

 

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


Re: [PATCH 2.3.1] wombat: make wInterlocked_set consistent

Damian Maguire <DMaguire@...>
 

Cheers for the patch Sam, looks good. Can you raise this in bugzilla
(bugs.openmama.org) as well, and we can track getting it into next
there?

Thanks,

Damian

On Thu, 2014-10-02 at 13:25 +0000, Sam Wilson wrote:
Hey,

Attached is a patch to make wInterlocked_set consistent between Windows
and Linux. The previous behaviour on Windows was to return the prior
value of the interlocked int, while on Linux the behaviour was to return
the new value.

This patch makes both platforms return the prior value, and updates the
documentation to express that.

diff --git a/common/c_cpp/src/c/linux/wInterlocked.h
b/common/c_cpp/src/c/linux/wInterlocked.h
index 6ee00db..720e54d 100644
--- a/common/c_cpp/src/c/linux/wInterlocked.h
+++ b/common/c_cpp/src/c/linux/wInterlocked.h
@@ -131,12 +131,11 @@ WCOMMONINLINE int
wInterlocked_read(wInterlockedInt *value)
*
* @param[in] newValue The new value to set.
* @param[in] value Pointer to the value to be set.
- * @return The updated integer.
+ * @return The original integer in value.
*/
WCOMMONINLINE int wInterlocked_set(int newValue, wInterlockedInt *value)
{
- axchg32(value, (uint32_t)newValue);
- return (int)*value;
+ return axchg32(value, (uint32_t)newValue);
}

#endif /* _WOMBAT_WINTERLOCKED_H */
diff --git a/common/c_cpp/src/c/windows/wombat/wInterlocked.h
b/common/c_cpp/src/c/windows/wombat/wInterlocked.h
index f5da11a..f93e088 100644
--- a/common/c_cpp/src/c/windows/wombat/wInterlocked.h
+++ b/common/c_cpp/src/c/windows/wombat/wInterlocked.h
@@ -87,7 +87,7 @@ WCOMMONINLINE int wInterlocked_read(wInterlockedInt
*value)
*
* @param[in] newValue The new value to set.
* @param[in] value Pointer to the value to be set.
- * @return The updated integer.
+ * @return The original integer in value.
*/
WCOMMONINLINE int wInterlocked_set(int newValue, wInterlockedInt *value)
{
________________________________________________________

This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
________________________________________________________


[PATCH 2.3.1] wombat: make wInterlocked_set consistent

Sam Wilson <Sam.Wilson@...>
 

Hey,

Attached is a patch to make wInterlocked_set consistent between Windows
and Linux. The previous behaviour on Windows was to return the prior
value of the interlocked int, while on Linux the behaviour was to return
the new value.

This patch makes both platforms return the prior value, and updates the
documentation to express that.

diff --git a/common/c_cpp/src/c/linux/wInterlocked.h
b/common/c_cpp/src/c/linux/wInterlocked.h
index 6ee00db..720e54d 100644
--- a/common/c_cpp/src/c/linux/wInterlocked.h
+++ b/common/c_cpp/src/c/linux/wInterlocked.h
@@ -131,12 +131,11 @@ WCOMMONINLINE int
wInterlocked_read(wInterlockedInt *value)
*
* @param[in] newValue The new value to set.
* @param[in] value Pointer to the value to be set.
- * @return The updated integer.
+ * @return The original integer in value.
*/
WCOMMONINLINE int wInterlocked_set(int newValue, wInterlockedInt *value)
{
- axchg32(value, (uint32_t)newValue);
- return (int)*value;
+ return axchg32(value, (uint32_t)newValue);
}

#endif /* _WOMBAT_WINTERLOCKED_H */
diff --git a/common/c_cpp/src/c/windows/wombat/wInterlocked.h
b/common/c_cpp/src/c/windows/wombat/wInterlocked.h
index f5da11a..f93e088 100644
--- a/common/c_cpp/src/c/windows/wombat/wInterlocked.h
+++ b/common/c_cpp/src/c/windows/wombat/wInterlocked.h
@@ -87,7 +87,7 @@ WCOMMONINLINE int wInterlocked_read(wInterlockedInt
*value)
*
* @param[in] newValue The new value to set.
* @param[in] value Pointer to the value to be set.
- * @return The updated integer.
+ * @return The original integer in value.
*/
WCOMMONINLINE int wInterlocked_set(int newValue, wInterlockedInt *value)
{


Re: [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

Damian Maguire
 

Hey Chad, 

I was just taking a look over this again, and decided that I'd stick it into Bugzilla to keep track of it there. If you'd like to sign up for an account you can add yourself as a CC to BZ164. We can follow up with any other required information there (though the main thing outstanding remains some evidence of testing, as mentioned in my previous mail).

Cheers, 

Damian

On Thu, Sep 18, 2014 at 11:56 AM, Damian Maguire <damian@...> wrote:
Cheers for the new patch Chad, looks good. 

At this stage we really need two things to progress getting this into OpenMAMA - firstly, can you raise a Bugzilla ticket, just to make it a bit easier to track the progress of the patch. Secondly, can you provide some evidence of testing? Generally we'd ask for unit tests, but the Java framework needs a bit of work, so in this case can you show a simple example application which demonstrates the usage of the new API? 

Thanks again for the contribution.

Damian

On Mon, Sep 15, 2014 at 3:31 PM, Meyer, Chad J <chad.j.meyer@...> wrote:

Hi Glenn,

 

I have applied the changes you recommended and created a new patch. Please see attached.

 

diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c

index 518bacf..aa1c4c6 100644

--- a/mama/jni/src/c/mamapublisherjni.c

+++ b/mama/jni/src/c/mamapublisherjni.c

@@ -76,40 +76,47 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher,

/*

  * Class:     com_wombat_mama_MamaPublisher

  * Method:    _create

- * Signature: (Lcom/wombat/mama/Transport;Ljava/lang/String;)V

+ * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V

  */

JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

-  (JNIEnv* env, jobject this, jobject transport, jstring topic)

+  (JNIEnv* env, jobject this, jobject transport, jstring topic, jstring source)

{

-    mamaPublisher   cPublisher          =   NULL;

+             mamaPublisher   cPublisher          =   NULL;

     mamaTransport   cTransport          =   NULL;

-    const char*     cTopic              =   NULL;

+    const char*     cSource             =   NULL;

+             const char*     cTopic                                                       =   NULL;

     jlong           transportPointer    =   0;

     mama_status     status              =   MAMA_STATUS_OK;

     char errorString[UTILS_MAX_ERROR_STRING_LENGTH];

     /*Get the transport pointer*/

     assert(transport!=NULL);

     transportPointer = (*env)->GetLongField(env, transport,

             transportPointerFieldId_g);

+

     cTransport = CAST_JLONG_TO_POINTER(mamaTransport, transportPointer);

-    assert(transportPointer!=0);

 

+    assert(transportPointer!=0);

     /*Get the char* from the jstring*/

     if(NULL!=topic)

     {

          cTopic = (*env)->GetStringUTFChars(env,topic,0);

          if(!cTopic)return;

     }

-   

+             if(NULL!=source)

+    {

+         cSource = (*env)->GetStringUTFChars(env,source,0);

+         if(!cSource)return;

+    }

+

     if(MAMA_STATUS_OK!=(mamaPublisher_create(

                     &cPublisher,

                     cTransport,

                     cTopic,

-                    NULL,

+                    cSource,

                     NULL)))

     {

-        if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+                             if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+        if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

         utils_buildErrorStringForStatus(

                 errorString, UTILS_MAX_ERROR_STRING_LENGTH,

                 "Failed to create publisher.", status);

@@ -121,6 +128,7 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

                          CAST_POINTER_TO_JLONG(cPublisher));

        

     if(cTopic)(*env)->ReleaseStringUTFChars(env,topic, cTopic);

+             if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

    

     return;

}

diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java

index 0146945..31bb1f5 100644

--- a/mama/jni/src/com/wombat/mama/MamaPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java

@@ -34,10 +34,15 @@ public class MamaPublisher

 

     /*A long value containing a pointer to the underlying C publisher structure*/

     private long    publisherPointer_i   =   0;

+            

+             public void create (MamaTransport transport, String topic)

+    {

+        _create(transport,topic,null);

+    }

 

-    public void create (MamaTransport transport, String topic)

+             public void create (MamaTransport transport, String topic, String source)

     {

-        _create(transport,topic);

+        _create(transport,topic,source);

     }

 

     public void send (MamaMsg msg)

@@ -76,7 +81,7 @@ public class MamaPublisher

         _sendFromInbox(inbox,msg);

     }

 

-    private native void _create (MamaTransport transport, String topic);

+    private native void _create (MamaTransport transport, String topic, String source);

 

     private native void _send (MamaMsg msg);

 

--

1.8.4.msysgit.0

 

Regards,

 

Chad Meyer | Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

 

 

From: Glenn McClements [mailto:gmcclements@...]
Sent: Monday, September 08, 2014 7:14 AM
To: Meyer, Chad J; openmama-dev@...
Subject: Re: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Thanks Chad.

 

For consistency though with the C++ interface, it should be (publisher, topic, source), not (publisher, source, topic).  

 

Also consider replacing/extending the existing JNI _create()

function rather than having two. This reduces code duplication and you already check for a NULL source being passed down so it should handle both Java methods. 

 

Glenn 

 

From: <Meyer>, Chad J <chad.j.meyer@...>
Date: Friday, 5 September 2014 22:42
To: "openmama-dev@..." <openmama-dev@...>
Subject: [Openmama-dev] [PATCH 2.3.1] MamaPublisher: Overloaded MamaPublisher create method

 

Hi,

 

Attached is a patch for OpenMAMA JNI that overloads the MamaPublisher create method. For consistency purposes, the new method requires two String parameters, source and symbol, as opposed to a single string currently found in the MamaPublisher class.  


diff --git a/mama/jni/src/c/mamapublisherjni.c b/mama/jni/src/c/mamapublisherjni.c

index 518bacf..629a51b 100644

--- a/mama/jni/src/c/mamapublisherjni.c

+++ b/mama/jni/src/c/mamapublisherjni.c

@@ -78,7 +78,7 @@ static void MAMACALLTYPE sendCompleteCB (mamaPublisher publisher,

  * Method:    _create

  * Signature: (Lcom/wombat/mama/Transport;Ljava/lang/String;)V

  */

-JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

+JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create__Lcom_wombat_mama_MamaTransport_2Ljava_lang_String_2

   (JNIEnv* env, jobject this, jobject transport, jstring topic)

{

     mamaPublisher   cPublisher          =   NULL;

@@ -125,6 +125,66 @@ JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create

     return;

}

 

+ /*

+ * Class:     com_wombat_mama_MamaPublisher

+ * Method:    _create

+ * Signature: (Lcom/wombat/mama/MamaTransport;Ljava/lang/String;Ljava/lang/String;)V

+ */

+JNIEXPORT void JNICALL Java_com_wombat_mama_MamaPublisher__1create__Lcom_wombat_mama_MamaTransport_2Ljava_lang_String_2Ljava_lang_String_2

+  (JNIEnv* env, jobject this, jobject transport, jstring source, jstring symbol)

+{

+             mamaPublisher   cPublisher          =   NULL;

+    mamaTransport   cTransport          =   NULL;

+    const char*     cSource             =   NULL;

+             const char*     cSymbol             =   NULL;

+    jlong           transportPointer    =   0;

+    mama_status     status              =   MAMA_STATUS_OK;

+    char errorString[UTILS_MAX_ERROR_STRING_LENGTH];

+            

+    /*Get the transport pointer*/

+    assert(transport!=NULL);

+    transportPointer = (*env)->GetLongField(env, transport,

+            transportPointerFieldId_g);

+    cTransport = CAST_JLONG_TO_POINTER(mamaTransport, transportPointer);

+    assert(transportPointer!=0);

+            

+    /*Get the char* from the jstring*/

+    if(NULL!=source)

+    {

+         cSource = (*env)->GetStringUTFChars(env,source,0);

+         if(!cSource)return;

+    }

+             if(NULL!=symbol)

+    {

+         cSymbol = (*env)->GetStringUTFChars(env,symbol,0);

+         if(!cSymbol)return;

+    }

+

+    if(MAMA_STATUS_OK!=(mamaPublisher_create(

+                    &cPublisher,

+                    cTransport,

+                    cSymbol,

+                    cSource,

+                    NULL)))

+    {

+        if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

+                             if(cSymbol)(*env)->ReleaseStringUTFChars(env,symbol, cSymbol);

+        utils_buildErrorStringForStatus(

+                errorString, UTILS_MAX_ERROR_STRING_LENGTH,

+                "Failed to create publisher.", status);

+        utils_throwMamaException(env,errorString);

+        return;

+    }

+

+    (*env)->SetLongField(env,this,publisherPointerFieldId_g,

+                         CAST_POINTER_TO_JLONG(cPublisher));

+       

+    if(cSource)(*env)->ReleaseStringUTFChars(env,source, cSource);

+             if(cSymbol)(*env)->ReleaseStringUTFChars(env,symbol, cSymbol);

+   

+    return;

+}

+

/*

  * Class:     com_wombat_mama_MamaPublisher

  * Method:    _send

diff --git a/mama/jni/src/com/wombat/mama/MamaPublisher.java b/mama/jni/src/com/wombat/mama/MamaPublisher.java

index 0146945..c1e8dc8 100644

--- a/mama/jni/src/com/wombat/mama/MamaPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaPublisher.java

@@ -39,6 +39,11 @@ public class MamaPublisher

     {

         _create(transport,topic);

     }

+            

+             public void create (MamaTransport transport, String source, String symbol)

+    {

+        _create(transport,source,symbol);

+    }

     public void send (MamaMsg msg)

     {

@@ -77,6 +82,8 @@ public class MamaPublisher

     }

     private native void _create (MamaTransport transport, String topic);

+            

+             private native void _create (MamaTransport transport, String source, String symbol);

     private native void _send (MamaMsg msg);

--

1.8.4.msysgit.0

 

 

Chad Meyer| Corporate & Investment Bank | PIM Market Data Services | J.P. Morgan | 4 Metrotech Center 23rd Floor Brooklyn, NY 11201 | Tel: (718) 242-5165 | M: (215) 801-2606 | chad.j.meyer@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev




Mama reserved fields as two struct types

Alpert, Reed <reed.alpert@...>
 

Hi,

 

Some reserved fields have both a MamaReservedField & mamaFieldDescriptor, and a larger set have only the MamaReservedField struct which does not have a type.

 

Is there a specific reason for this?

 

We are working on code to xlat an RsslDictionary into a MamaDictionary, and adding the reserved fields would be easier if all of them had just a field descriptor (and if there were a collection of those).

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

 

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Re: Enforcing field type on publish

Alpert, Reed <reed.alpert@...>
 

Hi Damian,

 

Yes, having a pluggable module that handles some pre/post events makes sense.

Our handler for this now is very JPM-specific, and I don’t think it would make sense to try and standardize that (checks field types, ensures there is a msgType, and adds some audit fields to track who/when/where published the msg).

 

To get a dictionary I put a hook in at the end of the transport create, since that is the first time we have enough info to check the config in mama.properties and then subscribe to the dictionary.

If that is OK then the dictionary is stashed in the transport data, and the pre-publish looks at that to see if it should apply the checks.

 

Begin able to load a shared obj via the library manager would work great.

For the pre/post events it seems like a lot to have a general list like transport create and publish and maybe bridge create, etc.

I’m not sure if that is overkill to fully fill out the list of pre/post events across many objects.

 

To store library data in the main objects’ data (e.g., bridge, transport, publisher, etc) maybe a user closure can be added.

Of course that assumes that a single pre/post library is installed.

 

I’ll keep adding things as our development continue.

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

 

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

From: Damian Maguire [mailto:damian@...]
Sent: Friday, September 19, 2014 11:53 AM
To: Alpert, Reed
Cc: Glenn McClements; Benjamin Taieb; Frank Quinn; fquinn.ni@...; Openmama-dev@...
Subject: Re: [Openmama-dev] Enforcing field type on publish

 

Hey Reed, 

 

This all sounds really interesting, particularly the fact that you have already identified multiple use cases for publish side hooks. A lot of it actually ties very nicely with some of the internal discussions we've been having around a plugin architecture for OpenMAMA as well, which in turn sit quite nicely with the library manager work which is also ongoing. 

 

At present myself and the team here are pretty solidly booked with a few internal projects (which should provide some real benefits to OpenMAMA when they're complete), so it'll be a few weeks before we can sit down and tackle this properly. However, I'd be very keen to get some full community engagement in discussing this, and work to put together a design that covers the requirements of the majority of potential use cases. With that in mind, if you guys can think of anywhere else where you believe hooks would be useful, or if you can think of any specific requirements for your current ideas, feel free to send them over and we'll start collating everything. 

 

Thanks, 

 

Damian

 

 

 

On Wed, Sep 17, 2014 at 8:03 PM, Alpert, Reed <reed.alpert@...> wrote:

Hi,

 

I agree, the callback to a module that can do publish checking/etc is good.

 

I prototyped a checking module, and it works, although loading the dictionary on 1st publish has a small delay, and also required that the publish not be from a mama timer callback, since that deadlocked either on sending the subscription on the throttle queue, or getting the dict back.

 

We actually have more requirements for publish that are very specific to our env (adding system audit fields to all publishes to track when/where the data comes from).

Having a callback we can engage would allow us to do this w/o any other users needing to have our stuff in the way.

So loading our module at runtime and calling it would work quite well.

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

 

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

From: Glenn McClements [mailto:gmcclements@...]
Sent: Thursday, September 11, 2014 5:20 AM
To: Alpert, Reed; Benjamin Taieb; Frank Quinn; fquinn.ni@...
Cc: Openmama-dev@...
Subject: Re: [Openmama-dev] Enforcing field type on publish

 

Hi Alpert, 

I like #2 more, but I still want to keep the more data model/market data/custom logic away from the core messaging part of OpenMAMA. 

 

What I’m thinking of is a hook/callback to a programmer defined function that would take the publisher, transport, message, a user defined closure etc that would return a status to indicate if the message should be published or not. The dictionary etc could be obtained at initialisation time through a separate init function. 

 

This dovetails with some of the other pieces of work going on:

  • we now have a framework for loading bridges dynamically, so the functionality could be in a library loaded automatically at startup
  • the hook above looks very much like publisher side entitlements (pass a publisher, message and expect a yes or no back) so we do 

 

I still need to work though this a bit more but let me know what you think.

 

Glenn 

 

From: <Alpert>, Reed <reed.alpert@...>
Date: Wednesday, 10 September 2014 19:13
To: Benjamin Taieb <benjamin.taieb@...>, Frank Quinn <fquinn@...>, "fquinn.ni@..." <fquinn.ni@...>, Glenn McClements <gmcclements@...>
Cc: "Openmama-dev@..." <Openmama-dev@...>
Subject: RE: [Openmama-dev] Enforcing field type on publish

 

Hi,

 

Yes I agree with Ben’s comments.

Here are some caveats:

1.      This is a feature that is requested by our market data infrastructure team to prevent app dev teams from accidentally publishing incorrect field types. We don’t believe that a voluntary program will work, which is why the FieldCache as a location is not preferred. Apps won’t use the FieldCache if they don’t need it, or are using an Excel plugin for publishing (quite common).

2.      This is a configured feature, and only for publication.

3.      This is not for subscription, that is, a subscriber can use any of the getXX() methods that work.

 

There seems to be general agreement that the OM layer is much better place for this feature than bridges themselves.

 

The two best locations seem to be:

1.      In mamaMsg, in the addXX and updateXX methods, probably with a macro like CHECK_MODIFY() that calls out to another module to do the work.

a.       This is good since it keep the message construction in mamaMsg module.

b.      This is good since it give the programmer the quickest feedback on an error condition.

c.       This is bad since it puts some performance hit on construction of every message, even on subscribe.

d.      This is bad since it makes the code active for creating subscribe messages too.

e.       This is bad since it puts more code in more places for this feature.

2.      In publisher.send() that checks a config var and then calls out to another module to do the work.

a.       This is good since it has minimal code changes, and minimal performance effect.

b.      This is good since it only affects publish messages.

c.       This is bad since it gives delayed failure, and there may be multiple fields that fail.

                                                              i.      Probably logging each failed field and returning an error code will work well to help developers fix problems.

 

I think the publisher.send() method is the best place, given the above.

 

But figuring out which dictionary to use for the checking seems to be the most difficult part.

Adding this feature as a config option may require also adding some optional config info about how to get a dictionary for a specific bridge, e.g., the source name.

 

Once the dictionary loading/mapping is solved then the rest seems fairly straightforward, except for the determination of allowed/denied conversions as configurable policy, but starting with 3 simple ones seems best:

1.      No checking (default)

2.      Type must match dictionary.

3.      Type must match dictionary, with a small number of allowed conversions that do not incur data loss (e.g., F32 -> F64).

 

Thanks,

 

Reed.


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev

 

This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


Re: [PATCH] QPID: Moving meta info to application properties

Philip Preston
 

Cool. Will take a look. Thanks

Phil


On 19 Sep 2014, at 18:39, Frank Quinn <fquinn.ni@...> wrote:

Hi Phil,

Note this has now been added to the new feature branch for broker support:

feature-qpid-broker

Cheers,
Frank

On Wed, Jun 11, 2014 at 8:04 PM, Frank Quinn <fquinn.ni@...> wrote:
Note this change also looks like it fixes warnings reported by the qpidd broker when you try and go through a dumb broker (i.e. one big queue):

2014-06-11 19:39:26 [Unspecified] warning Unexpected described list: 0x74

Cheers,
Frank


On Fri, Jun 6, 2014 at 9:39 AM, Frank Quinn <fquinn@...> wrote:

Thanks Phil – think this is the right thing to do, though I have a few follow up questions on the new bugzilla ticket for this so we can follow up there.

 

Only thing about this change is it will break backwards compatibility with previous versions of the qpid bridge, which in itself is not necessarily a bad thing, but we will need to communicate this well with all users if / when it makes it in, and possibly add some defensive code to detect when a mismatch is attempted and log accordingly etc etc.

 

Cheers,

Frank

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Philip Preston
Sent: 05 June 2014 23:54
To: OpenMAMA Dev List
Subject: [Openmama-dev] [PATCH] QPID: Moving meta info to application properties

 

Currently we add a number of custom properties to the properties section of the AMQP message (e.g. MsgType, Inbox Name).  The properties section of the message is used for a defined set of standard properties of the AMQP spec (message-id, user-id etc), and is not meant to be extensible for custom properties.  The Application Properties section of the AMQP message is the section for adding custom properties, in the form of a key (string), value map.

This change moves the following information from properties to application properties:

* Message Type
* Inbox Name
* Reply To
* Target Subject

Tested on

* Mac OS X 10.9.2 x86_64
* Ubuntu 12.04 x86_64

Tested for:

* Pub / Sub
* Pub / Inbox
* CaptureReplay / MamaListen
* Unit Tests

Signed-off-by: Phil Preston <philippreston@...>
---
 mama/c_cpp/src/c/bridge/qpid/codec.c     | 82 +++++++++++++++++++++++++-------
 mama/c_cpp/src/c/bridge/qpid/publisher.c |  9 ++--
 mama/c_cpp/src/c/bridge/qpid/qpiddefs.h  |  5 ++
 mama/c_cpp/src/c/bridge/qpid/transport.c | 19 ++++++--
 4 files changed, 89 insertions(+), 26 deletions(-)

diff --git a/mama/c_cpp/src/c/bridge/qpid/codec.c b/mama/c_cpp/src/c/bridge/qpid/codec.c
index 936ade0..27379c5 100644
--- a/mama/c_cpp/src/c/bridge/qpid/codec.c
+++ b/mama/c_cpp/src/c/bridge/qpid/codec.c
@@ -104,8 +104,8 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
     /* Ensure position is at the start */
     pn_data_rewind (properties);
 
-    /* Main container for meta data should be a list to allow expansion */
-    pn_data_put_list (properties);
+    /* Container for application properties is a map */
+    pn_data_put_map(properties);
 
     /* Enter into the list for access to its elements */
     pn_data_enter (properties);
@@ -116,8 +116,8 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
     {
         return status;
     }
-    pn_data_put_ubyte (properties, type);
-
+    pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_MSGTYPE),QPID_KEY_MSGTYPE));
+    pn_data_put_ubyte (properties,type);
 
     switch (type)
     {
@@ -129,14 +129,16 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
         {
             return status;
         }
+        pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_INBOXNAME),QPID_KEY_INBOXNAME));
         pn_data_put_string (properties, pn_bytes (strlen(inboxName),
-                                                  inboxName));
+                                                      inboxName));
 
         status = qpidBridgeMamaMsgImpl_getReplyTo (bridgeMessage, &replyTo);
         if (MAMA_STATUS_OK != status)
         {
             return status;
         }
+        pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_REPLYTO),QPID_KEY_REPLYTO));
         pn_data_put_string (properties, pn_bytes (strlen(replyTo),
                                                   replyTo));
 
@@ -149,6 +151,7 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
         {
             return status;
         }
+        pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_TARGETSUBJECT),QPID_KEY_TARGETSUBJECT));
         pn_data_put_string (properties, pn_bytes (strlen(targetSubject),
                                                   targetSubject));
         break;
@@ -253,13 +256,23 @@ qpidBridgeMsgCodec_unpack (msgBridge        bridgeMessage,
     /* Skip over the initial null atom */
     pn_data_next (properties);
 
-    /* Main container should be a list to allow expansion */
-    pn_data_get_list (properties);
+    /* Container for application properties is a map */
+    pn_data_get_map (properties);
     pn_data_enter (properties);
 
-    /* Get the message type out */
-    pn_data_next (properties);
-    type = (qpidMsgType) pn_data_get_ubyte (properties);
+    int found = 0;
+    found = pn_data_lookup (properties,QPID_KEY_MSGTYPE);
+    if (found)
+    {
+        type = (qpidMsgType) pn_data_get_ubyte (properties);
+    }
+    else
+    {
+        mama_log (MAMA_LOG_LEVEL_ERROR,
+                  "qpidBridgeMamaMsgImpl_unpack(): "
+                  "Unable to retrieve message type from message");
+        return MAMA_STATUS_PLATFORM;
+    }
 
     qpidBridgeMamaMsgImpl_setMsgType (bridgeMessage, type);
 
@@ -268,16 +281,38 @@ qpidBridgeMsgCodec_unpack (msgBridge        bridgeMessage,
     case QPID_MSG_INBOX_REQUEST:
 
         /* Move onto inbox name and extract / copy */
-        pn_data_next (properties);
-        prop = pn_data_get_string (properties);
+        found = pn_data_lookup (properties,QPID_KEY_INBOXNAME);
+        if (found)
+        {
+            prop = pn_data_get_string (properties);
+        }
+        else
+        {
+            mama_log (MAMA_LOG_LEVEL_ERROR,
+                      "qpidBridgeMamaMsgImpl_unpack(): "
+                      "Unable to retrieve inbox name");
+            return MAMA_STATUS_PLATFORM;
+        }
+
         status = qpidBridgeMamaMsgImpl_setInboxName (bridgeMessage, prop.start);
         if (MAMA_STATUS_OK != status)
         {
             return status;
         }
-        /* Move onto reply to url and extract / copy */
-        pn_data_next (properties);
-        prop = pn_data_get_string (properties);
+
+        found = pn_data_lookup (properties,QPID_KEY_REPLYTO);
+        if (found)
+        {
+            prop = pn_data_get_string (properties);
+        }
+        else
+        {
+            mama_log (MAMA_LOG_LEVEL_ERROR,
+                      "qpidBridgeMamaMsgImpl_unpack(): "
+                      "Unable to retrieve reply to url");
+            return MAMA_STATUS_PLATFORM;
+        }
+
         status = qpidBridgeMamaMsgImpl_setReplyTo (bridgeMessage, prop.start);
         if (MAMA_STATUS_OK != status)
         {
@@ -285,9 +320,20 @@ qpidBridgeMsgCodec_unpack (msgBridge        bridgeMessage,
         }
         break;
     case QPID_MSG_INBOX_RESPONSE:
-        /* Move onto target subject and extract / copy */
-        pn_data_next (properties);
-        prop = pn_data_get_string (properties);
+
+        found = pn_data_lookup (properties,QPID_KEY_TARGETSUBJECT);
+        if (found)
+        {
+            prop = pn_data_get_string (properties);
+        }
+        else
+        {
+            mama_log (MAMA_LOG_LEVEL_ERROR,
+                      "qpidBridgeMamaMsgImpl_unpack(): "
+                      "Unable to retrieve target container");
+            return MAMA_STATUS_PLATFORM;
+        }
+
         status = qpidBridgeMamaMsgImpl_setTargetSubject (bridgeMessage,
                                                          prop.start);
         if (MAMA_STATUS_OK != status)
diff --git a/mama/c_cpp/src/c/bridge/qpid/publisher.c b/mama/c_cpp/src/c/bridge/qpid/publisher.c
index 998b145..4d32475 100644
--- a/mama/c_cpp/src/c/bridge/qpid/publisher.c
+++ b/mama/c_cpp/src/c/bridge/qpid/publisher.c
@@ -587,12 +587,13 @@ qpidBridgePublisherImpl_setMessageType (pn_message_t* message, qpidMsgType type)
     /* Ensure position is at the start */
     pn_data_rewind (properties);
 
-    /* Main container should be a list to allow expansion */
-    pn_data_put_list (properties);
-    pn_data_enter (properties);
+    /* Container for application properties is a map */
+    pn_data_put_map(properties);
+    pn_data_enter(properties);
 
     /* Add the type */
-    pn_data_put_ubyte (properties, type);
+    pn_data_put_string(properties,pn_bytes(strlen(QPID_KEY_MSGTYPE),QPID_KEY_MSGTYPE));
+    pn_data_put_ubyte(properties,type);
 
     pn_data_exit (properties);
 
diff --git a/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h b/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h
index 8e686ea..6c1adf4 100644
--- a/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h
+++ b/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h
@@ -99,6 +99,11 @@ typedef enum qpidMsgType_
 
 #endif /* _PROTON_VERSION_H */
 
+/* Keys for application property map */
+#define QPID_KEY_MSGTYPE        "MAMAT"
+#define QPID_KEY_INBOXNAME      "MAMAI"
+#define QPID_KEY_REPLYTO        "MAMAR"
+#define QPID_KEY_TARGETSUBJECT  "MAMAS"
 
 /*=========================================================================
   =                Typedefs, structs, enums and globals                   =
diff --git a/mama/c_cpp/src/c/bridge/qpid/transport.c b/mama/c_cpp/src/c/bridge/qpid/transport.c
index 8ca9550..ba21810 100644
--- a/mama/c_cpp/src/c/bridge/qpid/transport.c
+++ b/mama/c_cpp/src/c/bridge/qpid/transport.c
@@ -1411,11 +1411,22 @@ void* qpidBridgeMamaTransportImpl_dispatchThread (void* closure)
 
             /* Move to the first element inside */
             pn_data_next     (properties); /* Move past first NULL byte */
-            pn_data_enter    (properties); /* Enter into meta list */
-            pn_data_next     (properties); /* Next lines up first entry */
+            pn_data_get_map(properties);
+            pn_data_enter    (properties); /* Enter into meta map */
 
-            /* Pull out the packet type */
-            msgNode->mMsgType = (qpidMsgType) pn_data_get_ubyte (properties);
+            int found = 0;
+            found = pn_data_lookup(properties,QPID_KEY_MSGTYPE);
+            if (found)
+            {
+                msgNode->mMsgType = (qpidMsgType) pn_data_get_ubyte (properties);
+            }
+            else
+            {
+                mama_log (MAMA_LOG_LEVEL_ERROR,
+                          "qpidBridgeMamaTransportImpl_dispatchThread(): "
+                          "Unable to retrieve message type from message");
+                return NULL;
+            }
 
             switch (msgNode->mMsgType)
             {
--
1.8.5.2 (Apple Git-48)

_______________________________________________


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange Group, Inc. (ICE), NYSE Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev




Re: [PATCH] QPID: Moving meta info to application properties

Frank Quinn <fquinn.ni@...>
 

Hi Phil,

Note this has now been added to the new feature branch for broker support:

feature-qpid-broker

Cheers,
Frank

On Wed, Jun 11, 2014 at 8:04 PM, Frank Quinn <fquinn.ni@...> wrote:
Note this change also looks like it fixes warnings reported by the qpidd broker when you try and go through a dumb broker (i.e. one big queue):

2014-06-11 19:39:26 [Unspecified] warning Unexpected described list: 0x74

Cheers,
Frank


On Fri, Jun 6, 2014 at 9:39 AM, Frank Quinn <fquinn@...> wrote:

Thanks Phil – think this is the right thing to do, though I have a few follow up questions on the new bugzilla ticket for this so we can follow up there.

 

Only thing about this change is it will break backwards compatibility with previous versions of the qpid bridge, which in itself is not necessarily a bad thing, but we will need to communicate this well with all users if / when it makes it in, and possibly add some defensive code to detect when a mismatch is attempted and log accordingly etc etc.

 

Cheers,

Frank

 

From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Philip Preston
Sent: 05 June 2014 23:54
To: OpenMAMA Dev List
Subject: [Openmama-dev] [PATCH] QPID: Moving meta info to application properties

 

Currently we add a number of custom properties to the properties section of the AMQP message (e.g. MsgType, Inbox Name).  The properties section of the message is used for a defined set of standard properties of the AMQP spec (message-id, user-id etc), and is not meant to be extensible for custom properties.  The Application Properties section of the AMQP message is the section for adding custom properties, in the form of a key (string), value map.

This change moves the following information from properties to application properties:

* Message Type
* Inbox Name
* Reply To
* Target Subject

Tested on

* Mac OS X 10.9.2 x86_64
* Ubuntu 12.04 x86_64

Tested for:

* Pub / Sub
* Pub / Inbox
* CaptureReplay / MamaListen
* Unit Tests

Signed-off-by: Phil Preston <philippreston@...>
---
 mama/c_cpp/src/c/bridge/qpid/codec.c     | 82 +++++++++++++++++++++++++-------
 mama/c_cpp/src/c/bridge/qpid/publisher.c |  9 ++--
 mama/c_cpp/src/c/bridge/qpid/qpiddefs.h  |  5 ++
 mama/c_cpp/src/c/bridge/qpid/transport.c | 19 ++++++--
 4 files changed, 89 insertions(+), 26 deletions(-)

diff --git a/mama/c_cpp/src/c/bridge/qpid/codec.c b/mama/c_cpp/src/c/bridge/qpid/codec.c
index 936ade0..27379c5 100644
--- a/mama/c_cpp/src/c/bridge/qpid/codec.c
+++ b/mama/c_cpp/src/c/bridge/qpid/codec.c
@@ -104,8 +104,8 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
     /* Ensure position is at the start */
     pn_data_rewind (properties);
 
-    /* Main container for meta data should be a list to allow expansion */
-    pn_data_put_list (properties);
+    /* Container for application properties is a map */
+    pn_data_put_map(properties);
 
     /* Enter into the list for access to its elements */
     pn_data_enter (properties);
@@ -116,8 +116,8 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
     {
         return status;
     }
-    pn_data_put_ubyte (properties, type);
-
+    pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_MSGTYPE),QPID_KEY_MSGTYPE));
+    pn_data_put_ubyte (properties,type);
 
     switch (type)
     {
@@ -129,14 +129,16 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
         {
             return status;
         }
+        pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_INBOXNAME),QPID_KEY_INBOXNAME));
         pn_data_put_string (properties, pn_bytes (strlen(inboxName),
-                                                  inboxName));
+                                                      inboxName));
 
         status = qpidBridgeMamaMsgImpl_getReplyTo (bridgeMessage, &replyTo);
         if (MAMA_STATUS_OK != status)
         {
             return status;
         }
+        pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_REPLYTO),QPID_KEY_REPLYTO));
         pn_data_put_string (properties, pn_bytes (strlen(replyTo),
                                                   replyTo));
 
@@ -149,6 +151,7 @@ qpidBridgeMsgCodec_pack (msgBridge      bridgeMessage,
         {
             return status;
         }
+        pn_data_put_string (properties,pn_bytes(strlen(QPID_KEY_TARGETSUBJECT),QPID_KEY_TARGETSUBJECT));
         pn_data_put_string (properties, pn_bytes (strlen(targetSubject),
                                                   targetSubject));
         break;
@@ -253,13 +256,23 @@ qpidBridgeMsgCodec_unpack (msgBridge        bridgeMessage,
     /* Skip over the initial null atom */
     pn_data_next (properties);
 
-    /* Main container should be a list to allow expansion */
-    pn_data_get_list (properties);
+    /* Container for application properties is a map */
+    pn_data_get_map (properties);
     pn_data_enter (properties);
 
-    /* Get the message type out */
-    pn_data_next (properties);
-    type = (qpidMsgType) pn_data_get_ubyte (properties);
+    int found = 0;
+    found = pn_data_lookup (properties,QPID_KEY_MSGTYPE);
+    if (found)
+    {
+        type = (qpidMsgType) pn_data_get_ubyte (properties);
+    }
+    else
+    {
+        mama_log (MAMA_LOG_LEVEL_ERROR,
+                  "qpidBridgeMamaMsgImpl_unpack(): "
+                  "Unable to retrieve message type from message");
+        return MAMA_STATUS_PLATFORM;
+    }
 
     qpidBridgeMamaMsgImpl_setMsgType (bridgeMessage, type);
 
@@ -268,16 +281,38 @@ qpidBridgeMsgCodec_unpack (msgBridge        bridgeMessage,
     case QPID_MSG_INBOX_REQUEST:
 
         /* Move onto inbox name and extract / copy */
-        pn_data_next (properties);
-        prop = pn_data_get_string (properties);
+        found = pn_data_lookup (properties,QPID_KEY_INBOXNAME);
+        if (found)
+        {
+            prop = pn_data_get_string (properties);
+        }
+        else
+        {
+            mama_log (MAMA_LOG_LEVEL_ERROR,
+                      "qpidBridgeMamaMsgImpl_unpack(): "
+                      "Unable to retrieve inbox name");
+            return MAMA_STATUS_PLATFORM;
+        }
+
         status = qpidBridgeMamaMsgImpl_setInboxName (bridgeMessage, prop.start);
         if (MAMA_STATUS_OK != status)
         {
             return status;
         }
-        /* Move onto reply to url and extract / copy */
-        pn_data_next (properties);
-        prop = pn_data_get_string (properties);
+
+        found = pn_data_lookup (properties,QPID_KEY_REPLYTO);
+        if (found)
+        {
+            prop = pn_data_get_string (properties);
+        }
+        else
+        {
+            mama_log (MAMA_LOG_LEVEL_ERROR,
+                      "qpidBridgeMamaMsgImpl_unpack(): "
+                      "Unable to retrieve reply to url");
+            return MAMA_STATUS_PLATFORM;
+        }
+
         status = qpidBridgeMamaMsgImpl_setReplyTo (bridgeMessage, prop.start);
         if (MAMA_STATUS_OK != status)
         {
@@ -285,9 +320,20 @@ qpidBridgeMsgCodec_unpack (msgBridge        bridgeMessage,
         }
         break;
     case QPID_MSG_INBOX_RESPONSE:
-        /* Move onto target subject and extract / copy */
-        pn_data_next (properties);
-        prop = pn_data_get_string (properties);
+
+        found = pn_data_lookup (properties,QPID_KEY_TARGETSUBJECT);
+        if (found)
+        {
+            prop = pn_data_get_string (properties);
+        }
+        else
+        {
+            mama_log (MAMA_LOG_LEVEL_ERROR,
+                      "qpidBridgeMamaMsgImpl_unpack(): "
+                      "Unable to retrieve target container");
+            return MAMA_STATUS_PLATFORM;
+        }
+
         status = qpidBridgeMamaMsgImpl_setTargetSubject (bridgeMessage,
                                                          prop.start);
         if (MAMA_STATUS_OK != status)
diff --git a/mama/c_cpp/src/c/bridge/qpid/publisher.c b/mama/c_cpp/src/c/bridge/qpid/publisher.c
index 998b145..4d32475 100644
--- a/mama/c_cpp/src/c/bridge/qpid/publisher.c
+++ b/mama/c_cpp/src/c/bridge/qpid/publisher.c
@@ -587,12 +587,13 @@ qpidBridgePublisherImpl_setMessageType (pn_message_t* message, qpidMsgType type)
     /* Ensure position is at the start */
     pn_data_rewind (properties);
 
-    /* Main container should be a list to allow expansion */
-    pn_data_put_list (properties);
-    pn_data_enter (properties);
+    /* Container for application properties is a map */
+    pn_data_put_map(properties);
+    pn_data_enter(properties);
 
     /* Add the type */
-    pn_data_put_ubyte (properties, type);
+    pn_data_put_string(properties,pn_bytes(strlen(QPID_KEY_MSGTYPE),QPID_KEY_MSGTYPE));
+    pn_data_put_ubyte(properties,type);
 
     pn_data_exit (properties);
 
diff --git a/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h b/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h
index 8e686ea..6c1adf4 100644
--- a/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h
+++ b/mama/c_cpp/src/c/bridge/qpid/qpiddefs.h
@@ -99,6 +99,11 @@ typedef enum qpidMsgType_
 
 #endif /* _PROTON_VERSION_H */
 
+/* Keys for application property map */
+#define QPID_KEY_MSGTYPE        "MAMAT"
+#define QPID_KEY_INBOXNAME      "MAMAI"
+#define QPID_KEY_REPLYTO        "MAMAR"
+#define QPID_KEY_TARGETSUBJECT  "MAMAS"
 
 /*=========================================================================
   =                Typedefs, structs, enums and globals                   =
diff --git a/mama/c_cpp/src/c/bridge/qpid/transport.c b/mama/c_cpp/src/c/bridge/qpid/transport.c
index 8ca9550..ba21810 100644
--- a/mama/c_cpp/src/c/bridge/qpid/transport.c
+++ b/mama/c_cpp/src/c/bridge/qpid/transport.c
@@ -1411,11 +1411,22 @@ void* qpidBridgeMamaTransportImpl_dispatchThread (void* closure)
 
             /* Move to the first element inside */
             pn_data_next     (properties); /* Move past first NULL byte */
-            pn_data_enter    (properties); /* Enter into meta list */
-            pn_data_next     (properties); /* Next lines up first entry */
+            pn_data_get_map(properties);
+            pn_data_enter    (properties); /* Enter into meta map */
 
-            /* Pull out the packet type */
-            msgNode->mMsgType = (qpidMsgType) pn_data_get_ubyte (properties);
+            int found = 0;
+            found = pn_data_lookup(properties,QPID_KEY_MSGTYPE);
+            if (found)
+            {
+                msgNode->mMsgType = (qpidMsgType) pn_data_get_ubyte (properties);
+            }
+            else
+            {
+                mama_log (MAMA_LOG_LEVEL_ERROR,
+                          "qpidBridgeMamaTransportImpl_dispatchThread(): "
+                          "Unable to retrieve message type from message");
+                return NULL;
+            }
 
             switch (msgNode->mMsgType)
             {
--
1.8.5.2 (Apple Git-48)

_______________________________________________


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange Group, Inc. (ICE), NYSE Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev




Re: Enforcing field type on publish

Damian Maguire
 

Hey Reed, 

This all sounds really interesting, particularly the fact that you have already identified multiple use cases for publish side hooks. A lot of it actually ties very nicely with some of the internal discussions we've been having around a plugin architecture for OpenMAMA as well, which in turn sit quite nicely with the library manager work which is also ongoing. 

At present myself and the team here are pretty solidly booked with a few internal projects (which should provide some real benefits to OpenMAMA when they're complete), so it'll be a few weeks before we can sit down and tackle this properly. However, I'd be very keen to get some full community engagement in discussing this, and work to put together a design that covers the requirements of the majority of potential use cases. With that in mind, if you guys can think of anywhere else where you believe hooks would be useful, or if you can think of any specific requirements for your current ideas, feel free to send them over and we'll start collating everything. 

Thanks, 

Damian



On Wed, Sep 17, 2014 at 8:03 PM, Alpert, Reed <reed.alpert@...> wrote:

Hi,

 

I agree, the callback to a module that can do publish checking/etc is good.

 

I prototyped a checking module, and it works, although loading the dictionary on 1st publish has a small delay, and also required that the publish not be from a mama timer callback, since that deadlocked either on sending the subscription on the throttle queue, or getting the dict back.

 

We actually have more requirements for publish that are very specific to our env (adding system audit fields to all publishes to track when/where the data comes from).

Having a callback we can engage would allow us to do this w/o any other users needing to have our stuff in the way.

So loading our module at runtime and calling it would work quite well.

 

Thanks,

 

Reed.

 


Reed Alpert | Corporate & Investment Bank | Market Data Services | J.P. Morgan | 4 Metrotech Center, 23rd Floor, Brooklyn, NY 11245 | T: 718.242.5198  | M: 917.414.4613 | reed.alpert@...

 

Alternate Contact:  CIB PIM Trading Technology Solutions NA | CIB_PIM_Trading_Technology_Solutions_NA@...

 

From: Glenn McClements [mailto:gmcclements@...]
Sent: Thursday, September 11, 2014 5:20 AM
To: Alpert, Reed; Benjamin Taieb; Frank Quinn; fquinn.ni@...
Cc: Openmama-dev@...
Subject: Re: [Openmama-dev] Enforcing field type on publish

 

Hi Alpert, 

I like #2 more, but I still want to keep the more data model/market data/custom logic away from the core messaging part of OpenMAMA. 

 

What I’m thinking of is a hook/callback to a programmer defined function that would take the publisher, transport, message, a user defined closure etc that would return a status to indicate if the message should be published or not. The dictionary etc could be obtained at initialisation time through a separate init function. 

 

This dovetails with some of the other pieces of work going on:

  • we now have a framework for loading bridges dynamically, so the functionality could be in a library loaded automatically at startup
  • the hook above looks very much like publisher side entitlements (pass a publisher, message and expect a yes or no back) so we do 

 

I still need to work though this a bit more but let me know what you think.

 

Glenn 

 

From: <Alpert>, Reed <reed.alpert@...>
Date: Wednesday, 10 September 2014 19:13
To: Benjamin Taieb <benjamin.taieb@...>, Frank Quinn <fquinn@...>, "fquinn.ni@..." <fquinn.ni@...>, Glenn McClements <gmcclements@...>
Cc: "Openmama-dev@..." <Openmama-dev@...>
Subject: RE: [Openmama-dev] Enforcing field type on publish

 

Hi,

 

Yes I agree with Ben’s comments.

Here are some caveats:

1.      This is a feature that is requested by our market data infrastructure team to prevent app dev teams from accidentally publishing incorrect field types. We don’t believe that a voluntary program will work, which is why the FieldCache as a location is not preferred. Apps won’t use the FieldCache if they don’t need it, or are using an Excel plugin for publishing (quite common).

2.      This is a configured feature, and only for publication.

3.      This is not for subscription, that is, a subscriber can use any of the getXX() methods that work.

 

There seems to be general agreement that the OM layer is much better place for this feature than bridges themselves.

 

The two best locations seem to be:

1.      In mamaMsg, in the addXX and updateXX methods, probably with a macro like CHECK_MODIFY() that calls out to another module to do the work.

a.       This is good since it keep the message construction in mamaMsg module.

b.      This is good since it give the programmer the quickest feedback on an error condition.

c.       This is bad since it puts some performance hit on construction of every message, even on subscribe.

d.      This is bad since it makes the code active for creating subscribe messages too.

e.       This is bad since it puts more code in more places for this feature.

2.      In publisher.send() that checks a config var and then calls out to another module to do the work.

a.       This is good since it has minimal code changes, and minimal performance effect.

b.      This is good since it only affects publish messages.

c.       This is bad since it gives delayed failure, and there may be multiple fields that fail.

                                                              i.      Probably logging each failed field and returning an error code will work well to help developers fix problems.

 

I think the publisher.send() method is the best place, given the above.

 

But figuring out which dictionary to use for the checking seems to be the most difficult part.

Adding this feature as a config option may require also adding some optional config info about how to get a dictionary for a specific bridge, e.g., the source name.

 

Once the dictionary loading/mapping is solved then the rest seems fairly straightforward, except for the determination of allowed/denied conversions as configurable policy, but starting with 3 simple ones seems best:

1.      No checking (default)

2.      Type must match dictionary.

3.      Type must match dictionary, with a small number of allowed conversions that do not incur data loss (e.g., F32 -> F64).

 

Thanks,

 

Reed.


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is proprietary, privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.


_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev



Re: VectorChar and VectorBool field type enumerator

Damian Maguire
 

Hey Alireza,

Thanks for sending this through, and sorry about the delayed response. In this case, I agree that these values should be added to the mamaFieldType enum, and their implementations should be completed across all the languages. 

At this stage you've really got two options - either raise a Bugzilla ticket and we'll see about getting it added when we have a chance, or submit a patch yourself which addresses the problems. For the patching option, that can be approached in stages easily enough - beginning with the enum updates (and associated mamaFieldTypeToString and stringToMamaFieldType changes, along with anything else which may misbehave given the new values), then filling in each of the language gaps in further commits.

Obviously we're happy to assist if you go down the route of patching yourself, just drop us a mail and we'll lend a hand.

Cheers, 

Damian

On Fri, Sep 5, 2014 at 8:35 PM, Alireza Assadzadeh <Alireza.Assadzadeh@...> wrote:

Hi folks,

 

I noticed that VectorChar and VectorBool do not have  a field type enumerator  in Mama (i.e. mamaFieldType enum in mama/fielddesc.h). Also, the related code for VectorChar and VectorBool in C/ C++, C#, JNI does not have the type related implementations for these vector types as compared to other vector types, such as VectorU32 (enumerator: MAMA_FIELD_TYPE_VECTOR_U32).

 

I imagine these types may not be widely and there are alternatives field types for them(e.g. Opaque, String and unsinged integer).

 

Should VectorChar and VectorBool  types be included in the mamaFieldType enum? For example with the numbers shown below:

 

<code>

diff --git a/mama/c_cpp/src/c/mama/fielddesc.h b/mama/c_cpp/src/c/mama/fielddesc.h

index e3af6e1..a374489 100644

--- a/mama/c_cpp/src/c/mama/fielddesc.h

+++ b/mama/c_cpp/src/c/mama/fielddesc.h

@@ -90,6 +90,8 @@ typedef enum mamaFieldType_

     MAMA_FIELD_TYPE_PRICE         =   27,

 

     /** Array type support */

+    MAMA_FIELD_TYPE_VECTOR_BOOL   =   29,

+    MAMA_FIELD_TYPE_VECTOR_CHAR   =   30,

     MAMA_FIELD_TYPE_VECTOR_I8     =   34,

     MAMA_FIELD_TYPE_VECTOR_U8     =   35,

     MAMA_FIELD_TYPE_VECTOR_I16    =   36,

</code>

 

And then also have the corresponding type related changes in the rest of Mama codebase?

 

Regards,.

 

--Alireza


_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev


941 - 960 of 2311